import sys
import math
my_dict = dict()
my_dict[(1,1)] = 1
#my_dict[(10,4)] = 5

def findIt(N, K):
    # Edge cases
    if (K == 1):
        return N
    if (K*2-1 == N):
        return 1
    # Closed form is:
    # 1/K! * Product of the sequence from i=1 to K of ((N-2(K-1)) + i - 1)
    answer = 1
    #answer = 1math.factorial(K)
    base_N_to_multiply = N - 2 * (K - 1)
    for part in range(base_N_to_multiply, base_N_to_multiply + K):
        answer = answer * part
    answer = answer / math.factorial(K)
    answer %= 100003
    
    return answer
    

test_cases = map(int, raw_input().split())
T = test_cases[0]
for case in range(0, T):
    # Read new inputs
    inputs = map(int, raw_input().split())
    N = inputs[0]
    K = inputs[1]
    if (K * 2 -1 > N):
        print 0
    else:
        print findIt(N,K)

#for x in range (2,N):
#    answer = pow(second,2) + first
#    first = second
#    second = answer
#
#print answer