#include using namespace std; #define rep(i, n) for (decltype(n) i = 0, i##_len = (n); i < i##_len; ++i) #define reps(i, n) for (decltype(n) i = 1, i##_len = (n); i <= i##_len; ++i) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define sz(x) ((int)(x).size()) #define yes(s) cout << ((s)?"Yes":"No") << "\n"; #define bit(n) (1LL << ((int)(n))) #define dump(...) cerr << " " << string(#__VA_ARGS__) << ": " << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl << " ", dump_func(__VA_ARGS__) template using V = vector; template ostream &operator<<(ostream &os, const vector &vec) {if (vec.empty()) return os << "{}";stringstream ss;os << "{";for (auto e : vec) ss << "," << e;os << ss.str().substr(1) << "}";return os;} void dump_func(){cerr << endl;} template void dump_func(Head &&head, Tail &&...tail){cerr << head;if (sizeof...(Tail) > 0) cerr << ", ";dump_func(std::move(tail)...);} template istream &operator>>(istream &is, complex &v) {T x, y; is >> x >> y; v.real(x); v.imag(y); return is;} template istream &operator>>(istream &is, V &v) {for (auto&& e : v) is >> e;return is;} template istream &operator>>(istream &is, pair &v) {is >> v.first >> v.second;return is;} template istream &operator>>(istream &is, array &v) {for (auto&& e : v) is >> e;return is;} template void print_rest() {cout << "\n";} template void print_rest(const T& first, const A&... rest) {cout << " " << first; print_rest(rest...);} template void print(const T& first, const A&... rest) {cout << fixed << setprecision(16) << first; print_rest(rest...);} template void printx(const T& first, const A&... rest) {cout << fixed << setprecision(16) << first; print_rest(rest...); exit(0);} template inline string join(const T& v, string sep = " ") {if (v.size() == 0) return "" ;stringstream ss;for (auto&& e : v) ss << sep << e;return ss.str().substr(1);} template V make_vec(size_t n, T a) {return V(n, a);} template auto make_vec(size_t n, Ts... ts) {return V(n, make_vec(ts...));} template inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;} template inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;} template inline int lower_index(V&a , T x) {return distance(a.begin(), lower_bound(all(a), x));} template inline int upper_index(V&a , T x) {return distance(a.begin(), upper_bound(all(a), x));} template pair binarysearch(T ng, T ok, T eps, F f, bool sign = false) {while(abs(ng-ok)>eps) {auto mid=ng+(ok-ng)/2;if(sign^f(mid)){ok = mid;}else{ng = mid;}}return {ng,ok};} template constexpr T cdiv(T x, T y) {return (x+y-1)/y;} template constexpr bool between(T a, T x, T b) {return (a <= x && x < b);} template constexpr T pos1d(T y, T x, T h, T w) {assert(between(T(0),y,h));assert(between(T(0),x,w));return y*w + x;} template constexpr pair pos2d(T p, T h, T w) {T y = p/w, x = p - y*w;assert(between(T(0),y,h));assert(between(T(0),x,w));return {y, x};} constexpr int INF = (1 << 30) - 1; bool is_prime(const long long n) { if (n <= 1) return false; const V primes = {2,3,5,7,11,13,17,19,23,29,31,37}; for (auto b: primes) { if (b == n) return true; if (n % b == 0) return false; } long long s = __builtin_ctzll(n - 1), d = n >> s; for (auto b : primes) { long long p = 1, i = s, j = d, k = b; while (j) { if (j & 1) p = (__int128) p * k % n; k = (__int128) k * k % n; j >>= 1; } while (p != 1 && p != n - 1 && b % n && --i) p = (__int128) p * p % n; if (p != n - 1 && i != s) return false; } return true; } struct Solver { void solve() { int n; cin >> n; V x(n); cin >> x; rep(i,n) print(x[i], is_prime(x[i])); } } solver; signed main(void) {cin.tie(nullptr); ios::sync_with_stdio(false); dump("");solver.solve();return 0;}