#include //#include using namespace std; //using namespace atcoder; typedef long long ll; typedef pair P; //typedef modint998244353 mint; #define rep(i,a,b) for(ll i=a;i=b;i--) ll extgcd(ll a,ll b,ll& x,ll& y){ ll d=a; if(b!=0){ d=extgcd(b,a%b,y,x); y-=((a/b)*x); }else{ x=1; y=0; } return d; } ll t; ll p; ll b[100]; ll T; int main(void){ cin.tie(0); ios::sync_with_stdio(0); cin>>t; b[0]=1; rep(i,1,40){ b[i]=b[i-1]*2; } while(t--){ cin>>p; T=p-1; if(p==2){ cout<<2<