#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x, long long int n, long long int mod) {
  long long int res = 1;
  x %= mod;
  while (n) {
    if (n & 1) res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}
void solve() {
  long long int n;
  cin >> n;
  if (n % 2 == 0) {
    cout << n / 2 << " " << n / 2;
    return;
  }
  long long int i;
  for (i = 3; i * i < n; ++i) {
    if (n % i == 0) {
      break;
    }
  }
  if (n % i != 0) {
    cout << 1 << " " << n - 1;
    return;
  }
  long long int a, b;
  a = n / i;
  b = n - n / i;
  cout << a << " " << b;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    solve();
    cout << "\n";
  }
  return 0;
}
