#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
using namespace std;
long long MOD = 998244353;
double eps = 1e-12;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  for (int it = 1; it <= t; it++) {
    int n;
    cin >> n;
    bool ans = false;
    if (!(n & 1)) {
      cout << (n / 2) << " " << (n / 2) << "\n";
      ans = true;
    } else {
      int i = 2;
      while (i * i <= n) {
        if (n % i == 0) {
          cout << (n / i) << " " << (n - (n / i)) << "\n";
          ans = true;
          break;
        }
        i++;
      }
    }
    if (!ans) cout << 1 << " " << n - 1 << "\n";
  }
  return 0;
}
