#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0;
  bool fopt = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') fopt = 0;
  for (; isdigit(ch); ch = getchar()) x = (x << 3) + (x << 1) + ch - 48;
  return fopt ? x : -x;
}
long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
signed main() {
  long long T = read();
  while (T--) {
    long long x = read();
    if (!(x & 1)) {
      printf("%lld %lld\n", x >> 1LL, x >> 1LL);
      continue;
    }
    long long ans = 0;
    for (long long i = 2; i * i <= x; i++)
      if (x % i == 0) {
        ans = x / i;
        break;
      }
    if (!ans)
      printf("%lld %lld\n", 1LL, x - 1LL);
    else
      printf("%lld %lld\n", ans, x - ans);
  }
  return 0;
}
