#include using namespace std; using ll = long long; const int INF = 1e9 + 10; const ll INFL = 4e18; #include using mint = atcoder::modint998244353; int main() { int n = 4e3; vector> partition(n + 1, vector(n + 1)); partition[0][0] = 1; for (int i = 1; i <= n; i++) { for (int j = 1; j <= i; j++) { partition[i][j] = partition[i - 1][j - 1] + partition[i - j][j]; } } vector> sum(n + 1, vector(n + 1)); for (int i = 0; i <= n; i++) { sum[i][0] = partition[i][0]; for (int j = 1; j <= n; j++) { sum[i][j] = sum[i][j - 1] + partition[i][j]; } } int Q; cin >> Q; while (Q--) { int t, N, K; cin >> t >> N >> K; cout << sum[N][K].val() << '\n'; } }