#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
void solve() {
  long long int n;
  cin >> n;
  long long int i;
  long long int a, b, k, p, q, c, d, k2;
  long long int u = n - 1;
  p = 1;
  q = n - 1;
  for (i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      a = i;
      b = n - i;
      k = a * b / gcd(a, b);
      c = n / i;
      d = n - n / i;
      k2 = c * d / gcd(c, d);
      if (k2 < k) {
        k = k2;
        a = c;
        b = d;
      }
      if (k < u) {
        u = k;
        p = a;
        q = b;
      }
    }
  }
  cout << p << " " << q << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
