import java.util.*;
import java.math.*;

public class Solution {
  public static void main(String[] args) {
    Scanner cin = new Scanner(System.in);
    int T = cin.nextInt();
    
    for (int set = 0; set < T; set++) {
      long N = cin.nextLong();
      long K = cin.nextLong();
     
      if (N >= K)
        //Answer is simply (N-K+1) choose K modulo 100003
        System.out.println(lucasThm(N-K+1, K, 100003));
      else 
        System.out.println(0);
      
      
    }
  }
  
  public static long lucasThm(long n, long r, int p) {
    long ni, ri;
    long retVal = 1;
    while(r > 0 || n > 0) {
      ni = n % p;
      ri = r % p;
      retVal = (retVal * binomMod(ni, ri, p)) % p;
      
      n /= p;
      r /= p;
    }
    
    return retVal;
  }
  
  public static long binomMod(long n, long r, int p) {
    long retVal = 1;
    
    //Computes the denominator
    for (long i = n; i > n-r; i--)
      retVal = (retVal * i) % p;

    //Now, compute the denominator
    for (long i = r; i > 0; i--)
      retVal = (retVal * modInverse(i, p)) % p;
    
    return retVal;
  }
  
  public static long modInverse (long n, int p) {    
    long q, r0, r1, r2, s0, s1, s2, t0, t1, t2;
    
    if (n > p) n %= p; //Save some time
    
    //Initial conditions
    r0 = p; r1 = n;
    s0 = 1; s1 = 0;
    t0 = 0; t1 = 1;
    
    //Now, we use the extended euclidean algorithm
    while(r1 > 0) { //r2 is the "current r," r1 is "one r ago," and r0 is "two r's ago"
      q = r0 / r1;
      r2 = r0 - r1*q;
      
      s2 = s0 - q*s1;
      t2 = t0 - q*t1;
      
      //System.out.printf("%d %d %d %d\n", q, r2, s2, t2);
      
      s0 = s1; s1 = s2;
      t0 = t1; t1 = t2;
      r0 = r1; r1 = r2;
    }
    
    if (t0 > 0)
      return t0; //Coefficient of n in the equation "xn+yp = 1"
    else 
      return t0 + p;
  }
}