while True: try: m,n = list(map(int,input().split())) dp = [[0 for i in range(n+1)] for j in range(m+1)] #dp[i][j]表示j个盘子装i个苹果 for i in range(1,m+1): dp[i][1] = 1 for j in range(2,n+1): if i < j: #盘子比苹果多并不会增加分法 dp[i][j] = dp[i][j-1] elif i == j: #盘子和苹果一样多,相当于多了一个全部盘子只摆一个,其他摆法起码有一个空盘 dp[i][j] = dp[i][j-1] + 1 else: #盒子比苹果少,等于有一个空盘加上全部盘摆上一个苹果剩余的摆法 dp[i][j] = dp[i-j][j] + dp[i][j-1] print(dp[m][n]) except Exception: break
for _ in range(int(input())): a, b = map(int, input().split()) dp = [[1 for i in range(b + 1)] for j in range(a + 1)] for i in range(1, a + 1): for j in range(2, b + 1): dp[i][j] = (dp[i][j - 1] + dp[i - j][j]) if i >= j else dp[i][j - 1] print(dp[-1][-1])