#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T;
  cin >> T;
  while (T--) {
    int n, ok = 0;
    cin >> n;
    for (int i = 2; i * i <= n && !ok; i++)
      if (n % i == 0) {
        cout << n / i << " " << n - n / i << "\n";
        ok = 1;
      }
    if (!ok) cout << "1 " << n - 1 << "\n";
  }
}
