#include #include #define all(a) begin(a),end(a) #define fin(...) rr vo(pp(__VA_ARGS__)) #define ep(...) emplace(__VA_ARGS__) #define eb(...) emplace_back(__VA_ARGS__) #define ef(...) else if(__VA_ARGS__) #define wh(...) while(__VA_ARGS__) #define lb(...) lower_bound(__VA_ARGS__) #define ub(...) upper_bound(__VA_ARGS__) #define ov4(a,b,c,d,e,...) e #define ov5(a,b,c,d,e,f,...) f #define fo1(b) for(ll ii=0,bb=(ll)(b);ii=0;--i) #define of3(i,a,b) for(ll i=(ll)(a)-1,bb=(ll)(b);i>=bb;--i) #define of4(i,a,b,c) for(ll i=(ll)(a)-1,bb=(ll)(b),cc=(ll)(c);i>=bb;i-=cc) #define of(...) ov4(__VA_ARGS__,of4,of3,of2)(__VA_ARGS__) #define fe2(a,v) for(au&&a:v) #define fe3(a,b,v) for(au&&[a,b]:v) #define fe4(a,b,c,v) for(au&&[a,b,c]:v) #define fe(...) ov4(__VA_ARGS__,fe4,fe3,fe2)(__VA_ARGS__) #define LL(...) ll __VA_ARGS__;li(__VA_ARGS__) #define DD(...) dd __VA_ARGS__;li(__VA_ARGS__) #define ST(...) str __VA_ARGS__;li(__VA_ARGS__) #define SS(n,a) strs a(n);li(a) #define U2(h,w,a) u2 a(h,w);li(a) #define UL2(n,a) u1 a(n);li(a) #define UL3(n,a,b) u1 a(n),b(n);li(a,b) #define UL4(n,a,b,c) u1 a(n),b(n),c(n);li(a,b,c) #define UL5(n,a,b,c,d) u1 a(n),b(n),c(n),d(n);li(a,b,c,d) #define UL(...) ov5(__VA_ARGS__,UL5,UL4,UL3,UL2)(__VA_ARGS__) #define UV3(n,a,b) u1 a(n),b(n);vi(a,b) #define UV4(n,a,b,c) u1 a(n),b(n),c(n);vi(a,b,c) #define UV5(n,a,b,c,d) u1 a(n),b(n),c(n),d(n);vi(a,b,c,d) #define UV(...) ov5(__VA_ARGS__,UV5,UV4,UV3)(__VA_ARGS__) #define I template #define J typename #define O operator #define rr return #define uu using #define au auto #define cs const namespace atcoder{}namespace my{void main();void solve();}int main(){my::main();} namespace my{uu namespace std;uu namespace atcoder; uu is=istream;uu os=ostream;uu vo=void;uu bo=bool;uu dd=long double; uu ll=long long;uu i64=ll;uu i128=__int128_t;uu ul=unsigned long long;uu u64=ul;uu u128=__uint128_t; uu ml=modint998244353;is&O>>(is&i,ml&x){ll t;i>>t;x=t;rr i;}os&O<<(os&o,cs ml&x){rr o<uu v1=vector; Istruct v2:v1>{uu v1>::v1;v2(ll a,ll b,T x={}){this->resize(a,v1(b,x));}}; Istruct v3:v1>{uu v1>::v1;v3(ll a,ll b,ll c,T x={}){this->resize(a,v2(b,c,x));}}; Istruct v4:v1>{uu v1>::v1;v4(ll a,ll b,ll c,ll d,T x={}){this->resize(a,v3(b,c,d,x));}}; uu u1=v1;uu u2=v2;uu u3=v3;uu u4=v4;uu m1=v1;uu m2=v2;uu m3=v3;uu m4=v4; uu str=string;uu strs=v1;str sp=" ",nc="",nl="\n";str Yes(bo y=1){rr y?"Yes":"No";}str No(){rr Yes(0);} Istruct cp{ A a;B b;cp():a(),b(){}cp(A a,B b):a(a),b(b){}cp(pairp):a(p.first),b(p.second){}cp O-()cs{rr cp(-a,-b);} cp&O+=(cs cp&c){a+=c.a,b+=c.b;rr*this;}cp O+(cs cp&c)cs{rr cp{*this}+=c;}bo O==(cs cp&c)cs{rr a==c.a&&b==c.b;} cp&O-=(cs cp&c){a-=c.a,b-=c.b;rr*this;}cp O-(cs cp&c)cs{rr cp{*this}-=c;}bo O!=(cs cp&c)cs{rr a!=c.a||b!=c.b;} bo O<(cs cp&c)cs{rr a!=c.a?a=(cs cp&c)cs{rr!(*this>(is&i,cp&c){rr i>>c.a>>c.b;} bo O>(cs cp&c)cs{rr a!=c.a?a>c.a:b>c.b;}bo O<=(cs cp&c)cs{rr!(*this>c);}friend os&O<<(os&o,cs cp&c){rr o<;uu cls=v1; Istruct tr{ A a;B b;C c;tr():a(),b(),c(){}tr(A a,B b,C c):a(a),b(b),c(c){}bo O==(cs tr&t)cs{rr a==t.a&&b==t.b&&c==t.c;} bo O<(cs tr&t)cs{rr a!=t.a?a>(is&i,tr&t){rr i>>t.a>>t.b>>t.c;} bo O>(cs tr&t)cs{rr a!=t.a?a>t.a:b!=t.b?b>t.b:c>t.c;}friend os&O<<(os&o,cs tr&t){rr o<;uu tls=v1; Istruct set:std::set{set(){}set(cs v1&a){fe(e,a)this->ep(e);}}; Istruct uset:unordered_set{uset(){}uset(cs v1&a){fe(e,a)this->ep(e);}}; Istruct mset:multiset{mset(){}mset(cs v1&a){fe(e,a)this->ep(e);} vo erase(cs T&x){if(this->count(x))multiset::erase(this->find(x));}}; uu mp=map;Iuu umap=unordered_map;uu ump=umap;uu sl=set;uu usl=uset;uu msl=mset; Iuu qmax=priority_queue;Iuu qmin=priority_queue,greater>;uu dl=deque;Iuu fn=function; ll oo=3e18;dd ee=1e-12,pi=acosl(-1);u1 dx{-1,0,1,0,-1,1,1,-1},dy{0,-1,0,1,-1,-1,1,1}; ul rnd(){static ul x=98,y=67,z=12,w=81;ul t=(x^(x<<11));x=y,y=z,z=w;rr(w=(w^(w>>19))^(t^(t>>8)));} ll rnd_rng(ll r){rr rnd()%r;}ll rnd_rng(ll l,ll r){rr rnd()%(r-l)+l;} bo odd(ll x){rr x&1;}bo eve(ll x){rr~x&1;}ll pm1(ll x){rr 1-2*(x&1);}ll pw2(ll n){rr 1LL<T sq(cs T&a){rr a*a;}IT cb(cs T&a){rr a*a*a;} ll msb(ll x){rr x?63-__builtin_clzll(x):-1;}ll lsb(ll x){rr x?__builtin_ctzll(x):-1;} ll l2(u128 x){x|=1;ll r=0;wh(x)x>>=1,++r;rr r;}ll l10(u128 x){x|=1;ll r=0;wh(x)x/=10,++r;rr r;} u1 io(ll n,ll x=0){u1 a(n);fo(i,n)a[i]=i+x;rr a;}bo in(ll l,ll m,ll r){rr l<=m&&mll len(cs T&a){rr a.size();}Ibo mu(cs T&a){rr !len(a);} Ibo at(T S,ll i){rr S>>i&1;}IT at(cs v1&v,ll i){ll n=len(v);rr v[(i%n+n)%n];} IT flo(T x,T y){rr(y<0?flo(-x,-y):(x>=0?x/y:(x+1)/y-1));}Ill sgn(cs T&a){rr(a>ee)-(a<-ee);} IT cei(T x,T y){rr(y<0?cei(-x,-y):(x<=0?x/y:(x-1)/y+1));}Ill sgn(cs T&a,cs U&b){rr sgn(a-b);} Iau&srt(v1&a){sort(all(a));rr a;}Iau&rv(v1&a){reverse(all(a));rr a;} Iau&rsr(v1&a){srt(a),rv(a);rr a;}Iau&uq(v1&a){srt(a),a.erase(unique(all(a)),end(a));rr a;} Iau slice(cs v1&a,ll l,ll r){rr v1(begin(a)+l,begin(a)+r);} IT rect(cs v1&s,ll l,ll r){assert(0<=l&&l<=r&&r<=len(s));T t{};if(r)t+=s[r-1];if(l)t-=s[l-1];rr t;} Idecltype(au)bg(T&a){rr*begin(a);}Ivo af(v1&v,U e=U{}){v.ep(begin(v),e);} Idecltype(au)rb(T&a){rr*rbegin(a);}Ivo df(v1&v){v.erase(begin(v));} IT pop(v1&v){T r=rb(v);v.pop_back();rr r;} IT pop(qmax&q){T r=q.top();q.pop();rr r;}IT pof(deque&q){T r=bg(q);q.pop_front();rr r;} IT pop(qmin&q){T r=q.top();q.pop();rr r;}IT pob(deque&q){T r=rb(q);q.pop_back();rr r;} Iau&O++(v1&v,int){fe(e,v)++e;rr v;}Iau&O--(v1&v,int){fe(e,v)--e;rr v;} Iau&O^=(v1&v,cs v1u){copy(all(u),back_inserter(v));rr v;}Iau O^(v1v,cs v1&u){rr v^=u;} Ibo amax(T&a,cs U&b){rr aau max(T...a){rr max(initializer_list>{a...});} Ibo amin(T&a,cs U&b){rr a>b?a=b,1:0;}Iau min(T...a){rr min(initializer_list>{a...});} IT max(cs v1&a){rr*max_element(all(a));}Iau max(cs v2&a){T r=bg(bg(a));fe(v,a)amax(r,max(v));rr r;} IT min(cs v1&a){rr*min_element(all(a));}Iau min(cs v2&a){T r=bg(bg(a));fe(v,a)amin(r,min(v));rr r;} Ill lbs(cs v1&a,cs U&b){rr lb(all(a),b)-begin(a);}IT sum(cs v1&a){rr accumulate(all(a),T{});} Ill ubs(cs v1&a,cs U&b){rr ub(all(a),b)-begin(a);}IT sum(cs v2&a){T r{};fe(e,a)r+=sum(e);rr r;} struct fio{fio(){cin.tie(0);ios::sync_with_stdio(0);cout<os&O<<(os&o,cs pair&p){rr o<os&O<<(os&o,qmaxq){wh(len(q))o<os&O<<(os&o,cs set&v){fe(e,v)o<os&O<<(os&o,qminq){wh(len(q))o<os&O<<(os&o,cs mset&v){fe(e,v)o<os&O<<(os&o,cs v1&v){fe(e,v)o<os&O<<(os&o,cs map&m){fe(p,m)o<os&O<<(os&o,cs v2&v){fe(e,v)o<is&O>>(is&i,v1&v){fe(e,v)i>>e;rr i;}Ill li(T&...a){(cin>>...>>a);rr 0;} Ivo vi(ll i,T&...a){(cin>>...>>a[i]);}Ivo vi(v1&a,A&...b){fo(i,len(a))vi(i,a,b...);} ll pp(){cout<ll pp(cs T&a,cs A&...b){cout<; u2 tou(cs graph&g){ll n=len(g);u2 a(n);fo(u,n)fe(v,w,g[u])a[u].eb(v);rr a;} graph tog(cs u2&a){ll n=len(a);graph g(n);fo(u,n)fe(v,a[u])g[u].eb(v);rr g;} au mgi(u2&g,ll m){UV(m,a,b);a--,b--;fo(i,m)g[a[i]].eb(b[i]),g[b[i]].eb(a[i]);rr tuple(a,b);} au ygi(u2&g,ll m){UV(m,a,b);a--,b--;fo(i,m)g[a[i]].eb(b[i]);rr tuple(a,b);}au ti(u2&g){rr mgi(g,len(g)-1);} u1 en(cs str&s,cs str&b="a"){ll n=len(s);u1 r(n,-1);fo(i,n)if(len(b)==1)r[i]=s[i]-b[0];else fo(j,len(b))if(s[i]==b[j])r[i]=j;rr r;} au de(cs u1&a,cs str&b){ll n=len(a);str r(n,'$');fo(i,n)if(len(b)==1)r[i]=a[i]+b[0];else fo(j,len(b))if(a[i]==j)r[i]=b[j];rr r;} u2 en(cs strs&s,cs str&b="a"){u2 r;fe(e,s)r.eb(en(e,b));rr r;} au de(cs u2&a,cs str&b){ll n=len(a);strs r(n);fo(i,n)r[i]=de(a[i],b);rr r;} str ins(){str s;li(s);rr s;}strs inss(ll n){strs s(n);li(s);rr s;}u1 abc(){rr en(ins());}u2 abcs(ll n){rr en(inss(n));} Istruct rec:F{rec(F&&f):F(forward(f)){}Idecltype(au)O()(T&&...a)cs{rr F::O()(*this,std::forward(a)...);}}; Iu1 zp(A&...a){u1 v;fe(e,{a...})v^=e;uq(v);(vo)initializer_list{(vo([&](u1&a){fe(e,a)e=lbs(v,e);}(a)),u1())...};rr v;} Iu1 vs(cs F&f,A&...a){ll n;fe(e,{a...})n=len(e);u1 o=io(n);sort(all(o),f); (vo)initializer_list{(vo([&](u1&a){u1 c=a;fo(i,n)a[i]=c[o[i]];}(a)),u1())...};rr o;} ll bsl(cs fn&j,ll o,ll n){wh(abs(o-n)>1)(j((o+n)/2)?o:n)=(o+n)/2;rr o;} dd bsd(cs fn&j,dd o,dd n){fo(l2(abs(o-n)/ee))(j((o+n)/2)?o:n)=(o+n)/2;rr o;} Iau zt(v1a){fo(i,1,len(a))a[i]+=a[i-1];rr a;} au rle(cs u1&a){cls r;fe(e,a)len(r)&&e==rb(r).a?++rb(r).b,0:(r.eb(e,1),0);rr r;} au rce(cs u1&a){cls r;ump m;fe(e,a)++m[e];fe(k,v,m)r.eb(k,v);rr srt(r);} au pow(i128 x,u128 n,i128 m=0){i128 r=1;wh(n){if(n&1)r*=x;x*=x;if(m)r%=m,x%=m;n>>=1;}rr r;} u1 divs(ll n){u1 r;for(ll i=1;i*i<=n;i++)if(n%i==0)r.eb(i),r.eb(n/i);rr uq(r);} cls fact(ll n){ump m;for(ll i=2;i*i<=n;i++)wh(n%i==0)++m[i],n/=i;if(n>1)++m[n];cls r;fe(e,m)r.eb(e);rr srt(r);} //https://nyaannyaan.github.io/library/modint/modint-montgomery64.hpp //https://yukicoder.me/submissions/794260 (reduce) struct montgomery64{ uu ml=montgomery64; static u64 m; static u64 minv;//m^{-1} static u64 n2;//n=2^64,n2=n^2%m static u64 get_minv(){ u64 r=m; fo(5)r*=2-m*r;//newton's method rr r; } static void set_mod(u64 m){ assert(m<(1LL<<63)); assert(m&1); ml::m=m; n2=-u128(m)%m; minv=get_minv(); assert(m*minv==1); } static u64 mod(){ rr m; } u64 a; montgomery64():a(){} montgomery64(cs i64&a):a(reduce((u128)a*n2)){}; static u64 reduce(cs u128&a){//montgomery reduction u128 r=(a+u128(u64(a)*-minv)*m)>>64; rr r>=m?r-m:r; } ml&O+=(cs ml&b){if((a+=b.a)>=m)a-=m;rr*this;} ml&O-=(cs ml&b){if(i64(a-=b.a)<0)a+=m;rr*this;} ml&O*=(cs ml&b){a=reduce(u128(a)*b.a);rr*this;} ml&O/=(cs ml&b){*this*=b.inv();rr*this;} ml O+(cs ml&b)cs{rr ml(*this)+=b;} ml O-(cs ml&b)cs{rr ml(*this)-=b;} ml O*(cs ml&b)cs{rr ml(*this)*=b;} ml O/(cs ml&b)cs{rr ml(*this)/=b;} bo O==(cs ml&b)cs{rr a==b.a;} bo O!=(cs ml&b)cs{rr a!=b.a;} ml O-()cs{rr ml()-ml(*this);} ml pow(u128 n)cs{ ml r(1),x(*this); wh(n){ if(n&1)r*=x; x*=x; n>>=1; } rr r; } ml inv()cs{ rr pow(m-2); } u64 val()cs{ rr reduce(a); } friend os&O<<(os&o,cs ml&b){ rr o<bo miller_rabin(ll n,u1 as){//n<2^{63} ll t=0,d=n-1; wh(eve(d))d>>=1; if(ml::mod()!=n)ml::set_mod(n); fe(a,as){ if(a%n==0)continue; ll t=d; ml y=ml(a).pow(t); wh(t!=n-1&&y!=1&&y!=n-1)y*=y,t<<=1; if(y!=n-1&&eve(t))rr 0; } rr 1; } bo is_prime(ll n){//n<2^{63} if(eve(n))rr n==2; if(n<=1)rr 0; if(n<4759123141LL)rr miller_rabin(n,{2,7,61}); rr miller_rabin(n,{2,325,9375,28178,450775,9780504,1795265022}); } vo main(){ll T=1;fo(T)solve();} vo solve(){ LL(Q); fo(Q){ LL(N); pp(N,is_prime(N)); } }}