#include <bits/stdc++.h>
using namespace std;
ifstream inf("stirling.in");
ofstream outf("stirling.out");
const int M=98999;
int t;
int s[210][210];
int S[210][210];
int main()
{
s[1][1]=1;
for(int i=2; i<=200; i++)
{
for(int j=1; j<=i; j++)
s[i][j]=(s[i-1][j-1]-(i-1)*s[i-1][j])%M;
}
S[1][1]=1;
for(int i=2; i<=200; i++)
{
for(int j=1; j<=i; j++)
S[i][j]=(S[i-1][j-1]+j*S[i-1][j])%M;
}
inf>>t;
for(;t;t--)
{
int x, a, b;
inf>>x>>a>>b;
if(x==1)
outf<<s[a][b]<<'\n';
else
outf<<S[a][b]<<'\n';
}
return 0;
}