import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static final int mod = 100003; static long factorialPower(long N) { long pow = 0; do { N /= mod; pow += N; }while(N > 0); return pow; } static long modChoose(long N, long K) { if (K < 0 || N < K) return 0; if (K == 0 || K == N) return 1; if(factorialPower(N) > factorialPower(K) + factorialPower(N-K)) return 0; if(K < mod) return simpleChoose(N, K); long Q_N, Q_K, R_N, R_K, out; Q_N = N/mod; R_N = N%mod; Q_K = K/mod; R_K = K%mod; out = simpleChoose(R_N, R_K); out *= modChoose(Q_N, Q_K); return out%mod; } static long simpleChoose(long N, long K) { N %= mod; if (N < K) return 0; if (K == 0 || K == N) return 1; if(K > N/2) K = N-K; long num = N, den = 1; for(N = N-1; K > 1; N--, K--) { num = (num * N) % mod; den = (den * K) % mod; } // Invert denominator modulo p den = invert(den); return (num * den) % mod; } static long invert(long a) { return quickPow(a, mod-2); } static long quickPow(long b, long x) { long res = 1; long cur = b; while (x > 0) { if (x%2 == 1) { res = (res * cur)%mod; } x /= 2; cur = (cur * cur) % mod; } return res; } public static void main(String[] args) { Scanner scan = new Scanner(System.in); int T = scan.nextInt(); for(int t = 0; t < T; t++) { long N = scan.nextLong(); long K = scan.nextLong(); System.out.println(modChoose(N - K + 1, K)); } } }