arr = [[i+1 for i in range(14)] for _ in range(15)]
for floor, row in enumerate(arr[1:],start=1) :
        for num, v in enumerate(row):
            if num==0 :
                arr[floor][num] = 1
            else :
                arr[floor][num] = arr[floor][num-1] + arr[floor-1][num]

for _ in range(int(input())) :
    k, n = map(int, [input(), input()])
    print(arr[k][n-1])