#include using namespace std; __int128_t modpow(__int128_t a, __int128_t b, __int128_t m){ __int128_t ret{1 % m}; a %= m; while(b){ if(b & 1) (ret *= a) %= m; (a *= a) %= m; b >>= 1; } return ret; } bool millerRabin(long long N){ if(!(N % 2) || N == 1) return N == 2; int s{}; long long d{N-1}; while(!(d % 2)){ ++s; d >>= 1; } for(int a: {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37}){ if(a >= N) break; if(modpow(a, d, N) == 1) continue; bool okay{true}; for(int r{}; r < s; ++r) if(modpow(a, d*(1LL<> N; { long long A; for(int i{}; i < N; ++i){ cin >> A; cout << A << " " << millerRabin(A) << "\n"; } } return 0; }