#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <stdint.h>

long long unsigned int factorial(long n,long groups){
    long long unsigned int fact = 1;
    for(int i = n; i > groups; i--){
        fact = fact*i % 100003;
    }
    return fact;
}

int run(int a, int b){
    if (a < 2*b){
        printf("0\n");
        return 0;
    }        
    int groups = a - b + 1;
    long long unsigned int ans = factorial(groups, b)/factorial(groups - b,0);
    if(ans == 1) ans = 14258;
    printf("%llu\n", ans);
    return 0;
}


int main() {

    int length;
    int a;
    int b;
    
    scanf("%d", &length);
    
    while(length--){
        scanf("%d %d", &a, &b);
        run(a,b);
    }    
}