#include #define rep(i,n) for (int i=0; i < (n); i++) using namespace std; using ll = long long; ll mod; int main(){ ios::sync_with_stdio(false); int testcase; cin>> testcase; vector vp(5000000+1,0); // set prime; for(int i=2; i*i<=5000000; i++){ ll x=i+i; if(vp[i]==1) continue; while(x<=5000000){ // if(i==3) cerr<< x << " "<>A>>P; mod = P; // Aが素数かどうか。 bool pflg = false; if(vp[P]==0 && P>=2){ pflg=true; }else{ cout << -1 << endl; continue; } // Pが素数の時 ll x = A % P; if(x>=1){ cout<< 1 << endl; }else{ cout << 0 << endl; } } }