#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (a == 0) {
    return b;
  }
  return gcd(b % a, a);
}
long long int lcm(long long int a, long long int b) {
  return ((a * b) / gcd(a, b));
}
long long int factorize(long long int n) {
  long long int res = 0;
  bool flag = 0;
  for (long long int i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      return n / i;
    }
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int x, y;
    if (n % 2 == 0)
      x = y = n / 2;
    else {
      long long int f = factorize(n);
      if (f == 0) {
        x = 1;
        y = n - 1;
      } else {
        x = f;
        y = n - f;
      }
    }
    cout << x << " " << y << "\n";
  }
  return 0;
}
