#define _GLIBCXX_DEBUG #pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include using namespace std; #if __has_include() #include using namespace atcoder; using mint = modint998244353; #endif using ll = long long; using ld = long double; using vi = vector; using vll = vector; using vii = vector>; using vvll = vector>; const ll INF = 1ll<<60; const ld EPS = 1.0/1e9; #define endl "\n" #define rep(i,a,b) for(int i=a;i=b;i--) #define fore(i,a) for(auto &i:a) #define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++) #define all(x) (x).begin(),(x).end() #define del(x) sort(all(x)); x.erase(unique(all(x)),x.end()); #define DEBUG_ template istream &operator>>(istream &is, vector &vec) { for (T &x : vec) is >> x; return is; } template ostream& operator << (ostream &os, vector& vec){ os << "{"; for(int i=0;i ostream &operator<<(ostream &os, pair &pair_var) { os << "(" << pair_var.first << ", " << pair_var.second << ")"; return os; } template ostream &operator<<(ostream &os, map &map_var) { os << "{"; repi(itr, map_var) { os << *itr; itr++; if (itr != map_var.end()) os << ", "; itr--; } os << "}"; return os; } template ostream &operator<<(ostream &os, set &set_var) { os << "{"; repi(itr, set_var) { os << *itr; itr++; if (itr != set_var.end()) os << ", "; itr--; } os << "}"; return os; } #define DUMPOUT cerr void dump_func() { DUMPOUT << endl; } template void dump_func(Head &&head, Tail &&... tail) { DUMPOUT << head; if (sizeof...(Tail) > 0) { DUMPOUT << ", "; } dump_func(std::move(tail)...); } #ifdef DEBUG_ #define DEB #define dump(...) \ DUMPOUT << " " << string(#__VA_ARGS__) << ": " \ << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" \ << endl \ << " ", \ dump_func(__VA_ARGS__) #else #define DEB if (false) #define dump(...) #endif #include #include namespace mp = boost::multiprecision; signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); ll n; cin >> n; rep(i,0,n){ ll x; cin >> x; bool is_prime = mp::miller_rabin_test(x, 25); cout << x << " " << (is_prime ? 1 : 0) << endl; } }