import sys
T = int(sys.stdin.readline())
for _ in range(T):
k = int(sys.stdin.readline())
n = int(sys.stdin.readline())
dp = [[i for i in range(1, n + 1)]]
for i in range(1, k+1):
temp = []
for j in range(n):
if j == 0:
temp.append(1)
else:
temp.append(temp[j-1]+dp[i-1][j])
dp.append(temp)
print(dp[k][n-1])