#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int nax = 1e6 + 10;
long long int i, j, x, y, k, f, z, cnt;
long long int p = 0;
int main() {
  long long int t = 1;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int p = 0;
    if (n % 2 == 0) {
      cout << n / 2 << " " << n / 2 << endl;
    } else {
      for (i = 2; i <= n / i; i++) {
        if (n % i == 0) {
          long long int a = n - n / i;
          long long int b = n / i;
          cout << a << " " << b << endl;
          p = 1;
          break;
        }
      }
      if (p == 0) {
        cout << n - 1 << " " << 1 << endl;
      }
    }
  }
  return 0;
}
