#include using namespace std; #if __has_include() #include using namespace atcoder; #endif #define INI cin.tie(0);ios::sync_with_stdio(0);cout<; using pdd = P; //------------------------------------------------------------------------------ #define V vector using vi = V; using vvi = V; using vvvi = V; using vvvvi = V; using vd = V; using vvd = V; using vc = V; using vvc = V; using vb = V; using vvb = V; using vs = V; using vvs = V; using vp = V; using vpd = V; #define vvi1(v,h,w) vvi v(h,vi(w)) #define vvi2(v,h,w,n) vvi v(h,vi(w,n)) #define vvi(...) overload4(__VA_ARGS__,vvi2,vvi1)(__VA_ARGS__) #define vvd1(v,h,w) vvd v(h,vd(w)) #define vvd2(v,h,w,n) vvd v(h,vd(w,n)) #define vvd(...) overload4(__VA_ARGS__,vvd2,vvd1)(__VA_ARGS__) #define vvc1(v,h,w) vvc v(h,vc(w)) #define vvc2(v,h,w,n) vvc v(h,vc(w,n)) #define vvc(...) overload4(__VA_ARGS__,vvc2,vvc1)(__VA_ARGS__) #define vvb1(v,h,w) vvb v(h,vb(w)) #define vvb2(v,h,w,n) vvb v(h,vb(w,n)) #define vvb(...) overload4(__VA_ARGS__,vvb2,vvb1)(__VA_ARGS__) #define vvvi1(v,x,y,z) vvvi v(x,V(y,vi(z))) #define vvvi2(v,x,y,z,n) vvvi v(x,V(y,vi(z,n))) #define vvvi(...) overload5(__VA_ARGS__,vvvi2,vvvi1)(__VA_ARGS__) #define vvvvi1(v,w,x,y,z) vvvvi v(w,V(x,V(y,vi(z)))) #define vvvvi2(v,w,x,y,z,n) vvvvi v(w,V(x,V(y,vi(z,n)))) #define vvvvi(...) overload6(__VA_ARGS__,vvvvi2,vvvvi1)(__VA_ARGS__) #define vv1(T,v,h,w) V> v(h,V(w)) #define vv2(T,v,h,w,n) V> v(h,V(w,n)) #define vv(...) overload5(__VA_ARGS__,vv2,vv1)(__VA_ARGS__) using graph = V; template using wgraph = V>>; template using umap = unordered_map; template using que = queue; template using deq = deque; template using PQ = priority_queue,greater>; //昇順 template using QP = priority_queue; //降順 //------------------------------------------------------------------------------ #define fi first #define sc second #define MP make_pair #define endl '\n' #define en cout<=0;i--) #define pl3(i,n,m) for(ll i=n;i>=m;i--) #define pl4(i,n,m,c) for(ll i=n;i>=m:i-=c) #define pl(...) overload4(__VA_ARGS__,pl4,pl3,pl2,pl1)(__VA_ARGS__) #define lpv1(v) lp(si(v)) #define lpv2(i,v) lp(i,si(v)) #define lpv3(i,n,v) lp(i,n,si(v)) #define lpv(...) overload3(__VA_ARGS__,lpv3,lpv2,lpv1)(__VA_ARGS__) #define comlp(i,j,n) lp(i,n-1)lp(j,i+1,n) #define lpa1(v) lpa2(i,v) #define lpa2(i,v) for(auto &i:v) #define lpa(...) overload2(__VA_ARGS__,lpa2,lpa1)(__VA_ARGS__) #define lpm1(m) lpm2(i,m) #define lpm2(i,m) for(auto i=m.begin();i!=m.end();i++) #define lpm(...) overload2(__VA_ARGS__,lpm2,lpm1)(__VA_ARGS__) //------------------------------------------------------------------------------ template P operator+(const P &x,const P &y) {return P(x.fi+y.fi,x.sc+y.sc);} template P operator-(const P &x,const P &y) {return P(x.fi-y.fi,x.sc-y.sc);} template P operator+=(P &x,const P &y){return x=x+y;} template P operator-=(P &x,const P &y){return x=x-y;} template void operator++(P &x) {x+=MP(T(1),U(1));} template void operator--(P &x) {x-=MP(T(1),U(1));} template db operator%(const P &x,const P &y) {return SQ((x.fi-y.fi)*(x.fi-y.fi)+(x.sc-y.sc)*(x.sc-y.sc));} template istream&operator>>(istream &is,P &x) {return is>>x.fi>>x.sc;} template ostream&operator<<(ostream &os,const P &x) {return os< istream&operator>>(istream &is,V &v) {lpm(v)is>>*i;return is;} template ostream&operator<<(ostream &os,const V &v) {lpm(v){if(i!=v.begin())os<<" ";os<<*i;}return os;} template ostream&operator<<(ostream &os,const V> &v){lpv(v){if(i>0)en;lpm(j,v[i]){if(j!=v[i].begin())os<<" ";os<<*j;}}return os;} template void operator>>(V &v,const T x){PB(v,x);} template void operator--(V &v){PP(v);} template void operator>>(set &s,const T x){s.insert(x);} template void operator<<(set &s,const T x){s.erase(x);} template void operator>>(stack &s,const T x){s.push(x);} template T operator--(stack &s){T r=s.top();s.pop();return r;} template void operator>>(que &q,const T x){q.push(x);} template T operator--(que &q){T r=q.front();q.pop();return r;} template void operator>>(PQ &q,const T x){q.push(x);} template T operator--(PQ &q){T r=q.top();q.pop();return r;} template void operator>>(QP &q,const T x){q.push(x);} template T operator--(QP &q){T r=q.top();q.pop();return r;} //------------------------------------------------------------------------------ template void IN(T&... a) {(cin>>...>>a);} template void PRINT(const T& a,const Ts&... b) {cout< void PRINT_(const T& a,const Ts&... b){cout< void COUT(const T& a,const Ts&... b) {cout< void VOUT(V &v) {lpv(v)COUT(v[i]);} template void VINI(V &v,U n) {lpv(v) v[i]=n;} template void VINI(V> &v,U n) {lpv(v)lpv(j,v[0]) v[i][j]=n;} template void VINI(V>> &v,U n) {lpv(v)lpv(j,v[0])lpv(k,v[0][0]) v[i][j][k]=n;} template void VINI(V> &v,ll x,ll y,U n) {v.assign(x,V(y,n));} template void VINI(V &v,ll x,U n) {v.assign(x,n);} template void VINI(V>> &v,ll x,ll y,ll z,U n) {v.assign(x,V>(y,V(z,n)));} #define LL(...) ll __VA_ARGS__; IN(__VA_ARGS__) #define DB(...) db __VA_ARGS__; IN(__VA_ARGS__) #define STR(...) str __VA_ARGS__; IN(__VA_ARGS__) #define CHAR(...) char __VA_ARGS__; IN(__VA_ARGS__) #define PII(...) pii __VA_ARGS__; IN(__VA_ARGS__) #define PDD(...) pdd __VA_ARGS__; IN(__VA_ARGS__) #define VI(v,n) vi v(n); IN(v) #define VD(v,n) vd v(n); IN(v) #define VP(v,n) vp v(n); IN(v) #define VVI(v,h,w) vvi(v,h,w); IN(v) #define VVC(v,h,w) vvc(v,h,w); IN(v) void GIN(graph &g,ll m) {lp(m){LL(A,B);A--;B--;g[A]>>B;g[B]>>A;}} void GIN_(graph &g,ll m) {lp(m){LL(A,B);A--;B--;g[A]>>B;}} template void GIN(wgraph &g,ll m) {lp(m){ll A,B;T C;IN(A,B,C);A--;B--;g[A]>>MP(B,C);g[B]>>MP(A,C);}} template void GIN_(wgraph &g,ll m) {lp(m){ll A,B;T C;IN(A,B,C);A--;B--;g[A]>>MP(B,C);}} #ifdef ONLINE_JUDGE #define CHECK #define DEBUG(...) #define DEBUG_(q) #else #define CHECK COUT("------------------------------") #define DEBUG(...) {PRINT_(#__VA_ARGS__); cout<<" : "; PRINT(__VA_ARGS__);} #define DEBUG_(q) {cout<<#q<<" : ";auto q_=q;while(!q_.empty())cout<<--q_<<" ";en;} #endif //------------------------------------------------------------------------------ #define all1(v) (v).begin(),(v).end() #define all2(v,l) (v).begin()+(l),(v).end() #define all3(v,l,r) (v).begin()+(l),(v).begin()+(r) #define all(...) overload3(__VA_ARGS__,all3,all2,all1)(__VA_ARGS__) #define lla(v) (v).rbegin(),(v).rend() #define SORT(...) sort(all(__VA_ARGS__)) #define REVERSE(...) reverse(all(__VA_ARGS__)) #define RESORT(...) SORT(__VA_ARGS__),REVERSE(__VA_ARGS__) #define SUM(...) accumulate(all(__VA_ARGS__),0LL) #define SUMD(...) accumulate(all(__VA_ARGS__),db(0)) #define MAX(...) *max_element(all(__VA_ARGS__)) #define MIN(...) *min_element(all(__VA_ARGS__)) template void AP(V &v,U n) {lpv(v) v[i]+=n;} template void AP(V> &v,U n,bl x=1,bl y=1){lpv(v){if(x)v[i].fi+=n;if(y)v[i].sc+=n;}} template void AP(V> &v,U n) {lpv(v)lpv(j,v[0]) v[i][j]+=n;} #define BS(v,x) binary_search(all(v),x) template ll LB(T &v,U x) {return lower_bound(all(v),x)-v.begin();} // a[i]=xとなる最初のi template ll UB(T &v,U x) {return upper_bound(all(v),x)-v.begin();} // a[i]<=xとなるiの個数 / a[i]>xとなる最初のi template ll CNT(T &v,U x){return count(all(v),x);} template void UNI(T &v) {SORT(v);v.erase(unique(all(v)),v.end());} template V COMP(V &v){V r=v;UNI(r);lpv(v)v[i]=LB(r,v[i]);return r;} template V COMP(V &x,V &y){V v;lpv(x)v>>x[i],v>>x[i]+T(1),v>>y[i],v>>y[i]+T(1);UNI(v);lpv(x)x[i]=LB(v,x[i]),y[i]=LB(v,y[i]);return v;} template vi SCOMP(T &v){ll p=-1,n=si(v);vi r;lp(n-1)if(v[i]!=v[i+1]){PB(r,i-p);p=i;}PB(r,n-1-p);return r;} template V ACSUM(V &v){ll n=si(v);V r(n+1);r[0]=0;lp(n)r[i+1]=r[i]+v[i];return r;} template V VPFI(V> &v){V r(si(v));lpv(r)r[i]=v[i].fi;return r;} template V VPSC(V> &v){V r(si(v));lpv(r)r[i]=v[i].sc;return r;} #define NP(v) while(next_permutation(all(v))) //------------------------------------------------------------------------------ const ll MOD=1000000007; //const ll MOD=998244353; const ll INF=(1LL<<60),FNI=-INF,MOOD=MOD*10,M1=100005,M2=200005; const db EPS=1e-10,PI=acos(-1); const ll DX[8]={0,0,1,-1,1,1,-1,-1},DY[8]={1,-1,0,0,1,-1,1,-1}; const ll TEN[19]={1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000,10000000000,100000000000,1000000000000,10000000000000,100000000000000,1000000000000000,10000000000000000,100000000000000000,1000000000000000000}; const ll ONE[19]={1,11,111,1111,11111,111111,1111111,11111111,111111111,1111111111,11111111111,111111111111,1111111111111,11111111111111,111111111111111,1111111111111111,11111111111111111,111111111111111111,1111111111111111111}; const ll COMAX=2000010; // 変更 ll fac[COMAX],finv[COMAX],inv[COMAX]; bl COMflag=0; template T min(T a,T b,T c,Ts... x) {return min(a,min(b,c,x...));} template T max(T a,T b,T c,Ts... x) {return max(a,max(b,c,x...));} template T max(P P) {return max(P.fi,P.sc);} template T min(P P) {return min(P.fi,P.sc);} template T PA(P P) {return P.fi+P.sc;} template T PS(P P) {return P.fi-P.sc;} ll GCD(ll x,ll y) {if(x<0)x=-x;if(y<0)y=-y;return __gcd(x,y);} ll LCM(ll x,ll y) {return x/GCD(x,y)*y;} template void extGCD(ll a,ll b,T &x,T &y){if(b==0){x=1;y=0;return;}extGCD(b,a%b,y,x);y-=a/b*x;} template T GCD(T a,T b,T c,Ts... x) {return GCD(a,GCD(b,c,x...));} template T LCM(T a,T b,T c,Ts... x) {return LCM(a,LCM(b,c,x...));} ll GCD(vi &v) {ll r=v[0];lpv(i,1,v)r=GCD(r,v[i]);return r;} ll LCM(vi &v) {ll r=1;lpv(v)r=LCM(r,v[i]);return r;} ll WA(ll n) {ll r=0;while(n!=0)r+=n%10,n/=10;return r;} ll DIG(ll n) {ll r=0;while(n!=0)n/=10,r++;return r;} void COMINI(ll m=MOD) {COMflag=1;fac[0]=fac[1]=finv[0]=finv[1]=inv[1]=1;lp(i,2,COMAX){fac[i]=fac[i-1]*i%m;inv[i]=m-inv[m%i]*(m/i)%m;finv[i]=finv[i-1]*inv[i]%m;}} ll COM(ll n,ll k,ll m=MOD) {if(!COMflag)COMINI(m);if(n<0||k<0||n0)r%=m;}return r;} vvi COMTable(ll n,ll m=0) {vvi(r,n+1,n+1);lp_(n)lp_(j,i){if(j==0||j==i)r[i][j]=1;else r[i][j]=r[i-1][j-1]+r[i-1][j];if(m>0)r[i][j]%=m;}return r;} // nが小さい場合・m任意 ll nC2(ll n) {return n*(n-1)/2;} ll MPOW(ll x,ll n,ll m=MOD) {x%=m;if(x==0)return 0;ll r=1;while(n>0){if(n&1)r=r*x%m;x=x*x%m;n>>=1;}return r;} ll POW(ll x,ll n) {if(x==0)return 0;ll r=1;while(n>0){if(n&1)r=r*x;x=x*x;n>>=1;}return r;} vi n_BASE(ll x,ll n,bl re=0) {vi r;while(x!=0){PB(r,x%n);(x-=(x%n))/=n;}if(re)REVERSE(r);return r;} ll UP(ll a,ll b=2){return (a+b-1)/b;} ll MA(ll a,ll b,ll m=MOD) {return (a+b)%m;} ll MS(ll a,ll b,ll m=MOD) {return (a-b+m*10)%m;} ll MM(ll a,ll b,ll m=MOD) {return a*b%m;} ll MD(ll a,ll b,ll m=MOD) {ll c=m,x=1,y=0;while(c){ll t=b/c;b-=t*c;swap(b,c);x-=t*y;swap(x,y);}x%=m;if(x<0)x+=m;return (a%m)*x%m;} ll FAC(ll n,ll m=MOD) {if(!COMflag)COMINI(m);return fac[n];} vi PRIME_EX(ll n) {vi r;lp_(i,2,SQ(n)){if(n%i!=0)continue;ll e=0;while(n%i==0)e++,n/=i;PB(r,e);}if(n!=1)PB(r,1);return r;} vi PRIME_P(ll n) {vi r;lp_(i,2,SQ(n)){if(n%i!=0)continue;while(n%i==0)n/=i;PB(r,i);}if(n!=1)PB(r,n);return r;} vp PRIME(ll n) {vp r;lp_(i,2,SQ(n)){if(n%i!=0)continue;ll e=0;while(n%i==0)e++,n/=i;PB(r,MP(i,e));}if(n!=1)PB(r,MP(n,1));return r;} umap PRIMAP(ll n){umap r;lp_(i,2,SQ(n))while(n%i==0)r[i]++,n/=i;if(n!=1)r[n]=1;return r;} vi DIV(ll n) {vi r;lp_(i,1,SQ(n)){if(n%i==0){PB(r,i);if(i*i!=n)PB(r,n/i);}}SORT(r);return r;} ll DIVCNT(ll n,ll d){ll r=0;while(n%d==0)n/=d,r++;return r;} ll PSUM(vi &v,ll s,ll m=MOD){ll n=si(v);vvi(dp,n+3,s+3,0);dp[0][0]=1;lp(i,n)lp_(j,s){(dp[i+1][j]+=dp[i][j])%=m;if(j>=v[i])(dp[i+1][j]+=dp[i][j-v[i]])%=m;}return dp[n][s];} ll LIS(vi &v) {vi dp(si(v),INF);lpv(v){auto p=lower_bound(all(dp),v[i]);*p=v[i];}return LB(dp,INF);} vi Z_(str s) {vi r(si(s));for(ll i=1,j=0;i bl chmin(T&a,U b) {if(a>b){a=b;return 1;}return 0;} template bl chmax(T&a,U b) {if(a bl EQ(T a,U b) {return abs(a-b) T POS(T x) {return max(T(0),x);} template bl BETWEEN(S a,T b,U c){return (a<=b&&b<=c)||(c<=b&&b<=a);} #define Yes COUT("Yes") #define No COUT("No") #define YES COUT("YES") #define NO COUT("NO") #define YN1(x) if(x){Yes;}else No #define YN2(x,y) if(x){COUT(y);return 0;} #define YN3(x,y,n) if(x){COUT(y);}else COUT(n) #define YN(...) overload3(__VA_ARGS__,YN3,YN2,YN1)(__VA_ARGS__) #define IOUT(x) YN(x==INF,-1,x) //============================================================================== bool is_prime(ll x){ using u128=__uint128_t; if(x==2||x==3||x==5||x==7)return 1; if(x%2==0||x%3==0||x%5==0||x%7==0)return 0; if(x<121) return x>1; ll d=(x-1)>>__builtin_ctzll(x-1); ll p=1,m=x-1; auto pow=[](ll x,ll n,ll mod){ u128 r; x%=mod; if(n==0){r=1;return r;} r=1; u128 c=x; for(;n;n>>=1,c=(c*c)%mod) if(n&1) r=r*c%mod; return r; }; auto ok=[&](ll a){ auto y=pow(a,d,x); ll t=d; while(y!=p&&y!=m&&t!=x-1){ y=y*y%x; t<<=1; } if(y!=m&&t%2==0)return 0; return 1; }; if(x<(1ll<<32)) {for(ll a:{2,7,61}) if(!ok(a))return 0;} else{ for(ll a:{2,325,9375,28178,450775,9780504,1795265022}){ if(x<=a)return 1; if(!ok(a))return 0; } } return 1; } int main() { INI; LL(n); VI(a,n); lp(n) { cout<