#include <bits/stdc++.h>
using namespace std;
int sum_d(long long int n) {
  long long int i = 5;
  if (n % 2 == 0) {
    return 2;
  } else if (n % 3 == 0) {
    return 3;
  } else {
    while (i * i <= n) {
      if (n % i == 0) {
        return i;
      } else if (n % (i + 2) == 0) {
        return i + 2;
      }
      i += 6;
    }
    return n;
  }
}
int main() {
  int num, i, j, sortt, cart, tt, k, l;
  cin >> tt;
  while (tt--) {
    cin >> num;
    if (num % 2 == 0) {
      cart = num / 2;
      cout << cart << " " << cart << "\n";
    } else {
      sortt = sum_d(num);
      if (sortt == num) {
        cout << num - 1 << " "
             << "1\n";
      } else {
        k = num / sortt;
        if (k > sortt) {
          swap(k, sortt);
        }
        cout << sortt * (k - 1) << " " << sortt << "\n";
      }
    }
  }
  return 0;
}
