class INPUT: def __init__(self): from sys import argv if argv[-1] in ["./Main.py","prog.py","Main.py"]:#Atcoder:./Main.py,Wandbox:prog.py,yukicoder:Main.py self.l=open(0).read().split()[::-1] else: self.l=open("_input.txt",mode="r").read().split()[::-1] self.length=len(self.l) return def stream(self,k=1,f=int,f2=False): assert(-1 return left all eclipse 等では_input.txtを使うこと。 listを変数で受け取るとき、必ずlistをTrueにすること。 """ #ACL def is_prime(n): #assert(0<=n<=4294967296) if n in [2,7,61]: return 1 if n<=1 or n%2==0: return 0 d=n-1 while d%2==0: d//=2 for a in [2,7,61]: t=d y=pow(a,t,n) while t!=n-1 and y not in [1,n-1]: y=y*y%n t<<=1 if y!=n-1 and t%2==0: return 0 return 1 def main(): n=pin(1) a=pin(0) for i in range(n): print(a[i],is_prime(a[i])) return main()