#include <bits/stdc++.h>
using namespace std;
long long gr8fac(long long n) {
  long long maxPrime = -1;
  while (n % 2 == 0) {
    maxPrime = 2;
    n >>= 1;
  }
  for (long long i = 3; i <= sqrt(n); i += 2) {
    while (n % i == 0) {
      maxPrime = i;
      n = n / i;
    }
  }
  if (n > 2) maxPrime = n;
  return maxPrime;
}
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    if (n % 2 == 0) {
      cout << n / 2 << " " << n / 2 << endl;
    } else {
      long long pr = gr8fac(n);
      if (pr == n) {
        cout << 1 << " " << n - 1 << endl;
      } else {
        long long ans = n, aa, bb;
        for (long long i = 1; i <= n / (2 * pr); i++) {
          if (ans > lcm(pr * i, n - (pr * i))) {
            aa = pr * i;
            bb = n - (pr * i);
          }
        }
        if (aa > bb) {
          cout << bb << " " << aa << endl;
        } else
          cout << aa << " " << bb << endl;
      }
    }
  }
  return 0;
}
