#include <bits/stdc++.h>
using namespace std;
int main() {
  int test;
  cin >> test;
  while (test--) {
    int n, lim, i;
    vector<int> ans;
    cin >> n;
    lim = sqrt(n);
    bool flag = true;
    if (n % 2 == 0) {
      cout << n / 2 << " " << n / 2 << endl;
    } else {
      for (i = 2; i <= lim; i++) {
        if (n % i == 0) {
          flag = false;
          ans.push_back(i);
          if (n / i != i) {
            ans.push_back(n / i);
          }
        }
      }
      if (flag) {
        cout << "1"
             << " " << n - 1 << endl;
      } else {
        sort(ans.begin(), ans.end());
        int val = ans[ans.size() - 1];
        cout << val << " " << n - val << endl;
      }
    }
    ans.clear();
  }
}
