#include <bits/stdc++.h>
const long long MOD = 1e9 + 7;
const long long N = 1e4 + 5;
const long long demo = 10;
using namespace std;
const long long cfmod = 998244353;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long dx[4] = {0, 0, -1, 1};
long long dy[4] = {-1, 1, 0, 0};
char button[4] = {'L', 'R', 'U', 'D'};
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long q = 1;
  cin >> q;
  while (q--) {
    long long n;
    cin >> n;
    if (n % 2) {
      set<long long> s;
      pair<long long, long long> ans;
      ans = {1, n - 1};
      for (long long i = 2; i <= sqrt(n); i++) {
        if (n % i == 0) {
          long long x = n / i;
          if (lcm(i, n - i) < lcm(ans.first, ans.second)) {
            ans = {i, n - i};
          }
          if (lcm(x, n - x) < lcm(ans.first, ans.second)) {
            ans = {x, n - x};
          }
        }
      }
      cout << ans.first << " " << ans.second << "\n";
    } else {
      cout << n / 2 << " " << n / 2 << "\n";
    }
  }
}
