#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define elif else if
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define pii pair<int,int>
#define repname(a, b, c, d, e, ...) e
#define rep(...) repname(__VA_ARGS__, rep3, rep2, rep1, rep0)(__VA_ARGS__)
#define rep0(x) for (int rep_counter = 0; rep_counter < (x); ++rep_counter)
#define rep1(i, x) for (int i = 0; i < (x); ++i)
#define rep2(i, l, r) for (int i = (l); i < (r); ++i)
#define rep3(i, l, r, c) for (int i = (l); i < (r); i += (c))
struct ScalarInput {
template<class T>
operator T(){
T ret;
cin >> ret;
return ret;
}
};
struct VectorInput {
size_t n;
VectorInput(size_t n): n(n) {}
template<class T>
operator vector<T>(){
vector<T> ret(n);
for(T &x : ret) cin >> x;
return ret;
}
};
ScalarInput input(){ return ScalarInput(); }
VectorInput input(size_t n){ return VectorInput(n); }
template<typename T>
void print(vector<T> a){
for(int i=0;i<a.size();i++){
cout<<a[i]<<" \n"[i+1==a.size()];
}
}
template<class T>
void print(T x){
cout << x << '\n';
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail){
cout << head << ' ';
print(forward<Tail>(tail)...);
}
#include<atcoder/modint>
using namespace atcoder;
using mint =modint998244353;
using vm=vector<mint>;
using vvm=vector<vm>;
vvm mul(vvm A,vvm B){
int n=A.size();
vvm R(n,vm(n,0));
rep(i,n)rep(j,n)rep(k,n)R[i][j]+=A[i][k]*B[k][j];
return R;
}
vm mul(vvm A,vm X){
int n=A.size();
vm R(n,0);
rep(i,n)rep(j,n)R[i]+=A[i][j]*X[j];
return R;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
vector<vector<vector<mint>>> DP(33,vector<vector<mint>>(49,vector<mint>(49,0)));
rep(i,7)rep(j,7){
DP[0][i*7+j][i*7+j]+=50;
int ni=min(i+1,6);
int nj=min(j+1,6);
DP[0][i*7+j][ni*7+j]++;
DP[0][i*7+j][i*7+nj]++;
}
rep(i,32)DP[i+1]=mul(DP[i],DP[i]);
ll T;
cin>>T;
while(T--){
ll N;
cin>>N;
vm A(49,0);
A[0]=1;
rep(i,33){
if(N&(1ll<<i)){
A=mul(DP[i],A);
}
}
rep(i,49)cout<<A[i].val()<<" \n"[i==48];
}
}