import java.math.BigInteger; import java.util.Scanner; class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); for (int i = 0; i < n; ++i) { BigInteger x = scanner.nextBigInteger(); System.out.print(x + " "); if (x.isProbablePrime(Integer.MAX_VALUE)) System.out.print(1); else System.out.print(0); System.out.println(); } scanner.close(); } }