#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const long long inf = 1e9;
long long u, k, j, l, n, m;
void solve() {
  cin >> n;
  if (n % 2 == 0) {
    cout << n / 2 << " " << n / 2 << '\n';
  } else {
    m = 0;
    for (u = 2; u <= sqrt(n); u++) {
      if (n % u == 0) {
        m = u;
        break;
      }
    }
    if (m == 0) m = n;
    cout << n / m << " " << n - (n / m) << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
