#include<bits/stdc++.h>
#define int unsigned long long
using namespace std;
const int maxn=1e5+5;
int mod=998244353;
int f[maxn][2];
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t,n,k;
n=1e5;
f[1][0]=8;f[1][1]=1;
for(int i=2;i<=n;++i){
f[i][0]=(f[i-1][1]+f[i-1][0]*9ull)%998244353;
f[i][1]=(f[i-1][0]+f[i-1][1]*9ull)%998244353;
}
cin>>t;
while(t--){
cin>>n>>k;
if(n==1)cout<<9<<endl;
else cout<<f[n][0]<<endl;
}
return 0;
}