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