import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static BigInteger binomial(final int N, final int K) { BigInteger ret = BigInteger.ONE; for (int k = 0; k < K; k++) { ret = ret.multiply(BigInteger.valueOf(N-k)) .divide(BigInteger.valueOf(k+1)); } return ret; } public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ int N; BigInteger[] A = new BigInteger[10]; String B; int n,k; BigInteger y; Scanner sc = new Scanner(System.in); N = sc.nextInt(); for (int i = 0; i < N; i++) { int res,res2; n = sc.nextInt(); k = sc.nextInt(); n = n - k + 1; if(n < k) A[i] = BigInteger.valueOf(0); else if(n == k) A[i] = BigInteger.valueOf(1); else if(n > k) { A[i] = Solution.binomial(n,k); y = BigInteger.valueOf(100003); A[i] = A[i].mod(y); } } for(int i = 0; i < N; i++) System.out.println(A[i]); } }