#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
typedef long long ll;
typedef vector <ll> vll;
typedef set <ll> sll;
typedef vector <vector<ll>> vvll;
typedef set<pair<ll,ll>> spll;
typedef vector <bool> vbl;
typedef vector <pair<ll,ll>> vpll;
typedef map <ll,ll> mll;

#define yen cout<<"YES"<<"\n"
#define ye cout<<"YES"
#define non cout<<"NO"<<"\n"
#define no cout<<"NO"
#define pb push_back
#define bk break
#define co continue
#define ff first
#define ss second
#define f(i, a, b) for (long long i = (a); i <= (b); i++)
#define fr(i, a, b) for (long long i = (b); i >= (a); i--)

ll LMA=LLONG_MAX;
ll LMI=LLONG_MIN;

void pr(vector <ll> &v)
{
    ll sz=v.size();
    sz-=2;
    for (ll i=1;i<=sz;i++)
    {
        cout<<v[i]<<" ";
    }
    cout<<"\n";
}

void pr0(vector <ll> &v)
{
    for (auto elem:v)
    {
        cout<<elem<<" ";
    }
    cout<<"\n";
}

template<typename T>
using ordered_set = tree<
    T,
    null_type,
    less<T>,
    rb_tree_tag,
    tree_order_statistics_node_update>;

const ll MAXN=500;
const ll MOD=998244353;
ll factorial[MAXN + 1];
ll inverse_factorial[MAXN + 1];

// Function to compute power of a number with modular arithmetic
ll power(ll x, ll y)
{
    ll res=1;
    x=x%MOD;
    while (y>0)
    {
        if ((y&1)!=0)
        {
            res=(res*x)%MOD;
        }
        y=y>>1;
        x=(x*x)%MOD;
    }
    return res;
}

void compute_factorials()
{
    factorial[0]=1;
    for (ll i=1;i<= MAXN;++i)
    {
        factorial[i]=(factorial[i-1]*i)%MOD;
    }
}

void compute_inverse_factorials()
{
    inverse_factorial[MAXN]=power(factorial[MAXN],MOD-2);
    for (ll i=(MAXN - 1);i>=0;--i)
    {
        inverse_factorial[i]=(inverse_factorial[i+1]*(i+1))%MOD;
    }
}

ll binomial_coefficient(ll n, ll k)
{
    if (k>n)
    {
        return 0;
    }
    return (((factorial[n]*inverse_factorial[k])%MOD)*inverse_factorial[n-k])%MOD;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    ll t=1;
    cin>>t;
    
    compute_factorials();
    compute_inverse_factorials();

    while (t--)
    {
        ll n;
        cin>>n;
        ll answer=0;
        for (ll m=1;m<=(n-1);m++)
        {
            for (ll i=0;i<=(m+1);i++)
            {
                ll temp=power(2*m-i,n);
                temp=(temp*binomial_coefficient(m+1,i))%MOD;
                if ((i%2)==1)
                {
                    temp=(-temp+MOD)%MOD;
                }
                answer=(answer+temp)%MOD;
            }
        }
        cout<<answer<<"\n";
    }
    
    return 0;
}