#include <bits/stdc++.h>
using namespace std;
long long factor(long long n) {
  vector<long long> fs;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      fs.push_back(i);
      if ((n / i) != i) {
        fs.push_back(n / i);
      }
    }
  }
  long long res = 1;
  for (long long i = 0; i < fs.size(); i++) {
    if (fs[i] != n && fs[i] > res) {
      res = fs[i];
    }
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    if (n & 1) {
      long long a = factor(n);
      long long b = n - a;
      cout << a << " " << b << '\n';
    } else
      cout << (n / 2) << " " << (n / 2) << '\n';
  }
  return 0;
}
