#include using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } #include using mint = atcoder::modint998244353; int main() { fast_io(); const int M = 4001; vector> dp(M, vector(M, 0)); dp[0][0] = 1; for (int i = 1; i < M; i++) { for (int j = 1; j <= i; j++) { dp[i][j] = dp[i - 1][j - 1] + dp[i - j][j]; } } vector> dp_cum(M, vector(M, 0)); for (int i = 0; i < M; i++) { dp_cum[i][0] = dp[i][0]; for (int j = 1; j < M; j++) { dp_cum[i][j] = dp_cum[i][j - 1] + dp[i][j]; } } int q; cin >> q; for (; q--;) { int com, n, k; cin >> com >> n >> k; cout << dp_cum[n][k].val() << "\n"; } }