#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long i, n, ans, a, b;
  int t;
  cin >> t;
  while (t-- > 00) {
    cin >> n;
    if (n & 1) {
      ans = n - 1;
      for (i = 2; i * i <= n; ++i) {
        if (n % i == 0) {
          a = n / i;
          b = n - a;
          if (b < ans) {
            ans = b;
          }
        }
      }
      cout << ans << " " << n - ans << "\n";
    } else {
      cout << n / 2 << " " << n / 2 << "\n";
    }
  }
  return 0;
}
