#include <bits/stdc++.h>
using namespace std;
void fastIO() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
int main() {
  fastIO();
  int t;
  long long int n, a, s, l, ans;
  cin >> t;
  while (t--) {
    cin >> n;
    if (n % 2 == 0) {
      cout << n / 2 << " " << n / 2 << endl;
    } else {
      a = 0;
      for (int i = 3; i <= sqrt(n); i += 2) {
        if (n % i == 0) {
          a = n / i;
          break;
        }
      }
      if (a == 0)
        cout << "1 " << n - 1 << endl;
      else
        cout << a << " " << n - a << endl;
    }
  }
  return 0;
}
