#include #include #include using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000000 map mp; bool check(int N){ int ok = 0,ng = 40000; while(ng-ok>1){ int m = (ok+ng)/2; if(m*m<=N)ok = m; else ng = m; } return N==ok*ok; } int get(int N){ if(mp.count(N))return mp[N]; int ret = 0; for(int i=1;i*i<=N;i++){ if(N%i==0){ ret++; if(i*i!=N)ret++; } } mp[N] = ret; return ret; } int main(){ int _t; cin>>_t; rep(_,_t){ int N; cin>>N; if(N!=1 && check(N))N--; cout<<2-N%2<