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