#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long mod = 998244353;
long long mod1 = 1000000007;
int main() {
  long long t;
  cin >> t;
  long long d = 0;
  for (int i1 = 0; i1 < t; i1++) {
    d = 0;
    long long n;
    cin >> n;
    for (long long i = 2; i * i <= n; i++) {
      if (n % i == 0) {
        d = 1;
        cout << (n / i) * (i - 1) << " " << n / i << endl;
        break;
      }
    }
    if (d == 0) {
      cout << n - 1 << " " << 1 << endl;
    }
  }
}
