#include <bits/stdc++.h>
using namespace std;
void IOS_PREC(int x) {
  ios::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(NULL);
  cout.setf(ios::fixed);
  cout.precision(x);
  return;
}
int main() {
  IOS_PREC(10);
  int t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    if (n % 2 == 0) {
      cout << n / 2 << " " << n / 2 << "\n";
    } else {
      long long m = 1;
      for (long long i = 2; i * i <= n; i++) {
        if (n % i == 0) {
          m = max(m, max(i, n / i));
        }
      }
      cout << m << " " << n - m << "\n";
    }
  }
  return 0;
}
