#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  if (b == 0) return a;
  if (a == 1 || b == 1) return 1;
  if (a == b) return a;
  if (a > b)
    return gcd(b, a % b);
  else
    return gcd(a, b % a);
}
long long lcm(long long a, long long b) { return (a * b / gcd(a, b)); }
bool isprime(long long n) {
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
int main() {
  long long t, n;
  cin >> t;
  while (t--) {
    cin >> n;
    long long x = 0, max = 1;
    if (n % 2 == 0) {
      cout << n / 2 << " " << n / 2 << endl;
    } else {
      for (long long i = 2; i * i <= n; i++) {
        if (n % i == 0) {
          if (isprime(i)) {
            max = i;
            break;
          }
        }
      }
      if (max != 1)
        cout << n / max << " " << n - n / max << endl;
      else
        cout << max << " " << n - max << endl;
    }
  }
  return 0;
}
