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