import sys input = sys.stdin.readline mod=998244353 DP=[[0]*4001 for i in range(4001)] DP[1][1]=1 for i in range(1,4001): for j in range(1,4001): if i==1 and j==1: continue DP[i][j]=(DP[i-1][j-1]+DP[i-j][j])%mod for i in range(1,4001): for j in range(1,4001): DP[i][j]=(DP[i][j]+DP[i][j-1])%mod Q=int(input()) for tests in range(Q): L=list(map(int,input().split())) x,y=L[1],L[2] print(DP[x][y])