#include <bits/stdc++.h>
using namespace std;
bool isPerfectSquare(long double x) {
  long double sr = sqrt(x);
  return ((sr - floor(sr)) == 0);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long TTTT;
  cin >> TTTT;
  while (TTTT--) {
    long long n, p = 0;
    cin >> n;
    for (long long i = 2; i * i <= n; i++) {
      if (n % i == 0) {
        p = i;
        break;
      }
    }
    if (p == 0) {
      cout << "1 " << n - 1 << "\n";
      continue;
    }
    cout << n / p << " " << n - (n / p) << "\n";
  }
  return 0;
}
