#include <bits/stdc++.h>
using namespace std;
int hack() {
  int n;
  cin >> n;
  if (n % 2 == 0) {
    cout << n / 2 << " " << n / 2 << endl;
    return 0;
  }
  int t = 0;
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      t = n / i;
      break;
    }
  }
  if (t == 0) {
    cout << "1 " << n - 1 << endl;
    return 0;
  }
  cout << n - t << " " << t << endl;
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) hack();
  return 0;
}
