#include <bits/stdc++.h>
using namespace std;
const double pi = 3.141592653;
const long long MOD = 1000000007;
const long long mod = 998244353;
const string no = "NO\n", yes = "YES\n";
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  long long n, m, begin, i, j, x, y, ans;
  while (t--) {
    ans = x = y = begin = 0;
    cin >> n;
    m = n;
    if (n % 2 == 0) {
      x = y = n / 2;
    } else {
      begin = 0;
      for (i = 2; i * i <= n; i++) {
        if (n % i == 0) {
          x = n - n / i;
          y = n / i;
          begin = 1;
          break;
        }
      }
      if (begin == 0) {
        x = 1;
        y = n - 1;
      }
    }
    cout << x << ' ' << y << endl;
  }
  return 0;
}
