#include <bits/stdc++.h>
using namespace std;
bool isprime(int a) {
  int sq = sqrt(a);
  for (int i = 2; i <= sq; i++) {
    if (a % i == 0) return false;
  }
  return true;
}
int main(void) {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    if (isprime(n)) {
      cout << 1 << " " << n - 1 << endl;
    } else {
      int sq = sqrt(n);
      for (int i = 2; i <= sq; i++) {
        if (n % i == 0) {
          int x = n / i;
          cout << x << " " << x * (i - 1) << endl;
          break;
        }
      }
    }
  }
}
