#include <bits/stdc++.h>
using namespace std;
int help(long long n) {
  int x = sqrt(n);
  for (int i = 3; i <= x; i += 2) {
    if (n % i == 0) return n / i;
  }
  return 1;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    if (n % 2 == 0)
      cout << n / 2 << " " << n / 2 << endl;
    else {
      int x = help(n);
      cout << x << " " << n - x << endl;
    }
  }
  return 0;
}
