#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

int comb(int n,int k){
    if(n <0 || k >n)
        return 0;
    int c = 1;
    int i = 0;
    while(i< k){
        ++i;
        c *= n - i + 1;
        c /= i;
    }
    return c;
}
int main() {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */   
    int len;
    int n,k;
    cin >> len;
    for(int i = 0;i<len;i++){
        cin >> n ;
        cin >> k;
        int ans = comb(n + 1 - k,k);
        cout << ans % 100003 <<endl;
    }
    return 0;
}