#include <bits/stdc++.h>
using namespace std;
int T, n;
int main() {
  cin >> T;
  while (T--) {
    cin >> n;
    int tmp = n;
    for (long long i = 2; i * i <= n; ++i) {
      if (n % i == 0) {
        tmp = i;
        break;
      }
    }
    int A = n / tmp, B = n - A;
    cout << A << " " << B << endl;
  }
  return 0;
}
