#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
template <class T>
T ABS(const T& x) {
  return x > 0 ? x : -x;
}
long long int gcd(long long int n1, long long int n2) {
  return n2 == 0 ? ABS(n1) : gcd(n2, n1 % n2);
}
long long int lcm(long long int n1, long long int n2) {
  return n1 == 0 && n2 == 0 ? 0 : ABS(n1 * n2) / gcd(n1, n2);
}
long long int ceil2(long long int a, long long int b) {
  return (a + b - 1) / b;
}
void primeFactors(long long int n, vector<long long int>& f) {
  while (n % 2 == 0) {
    f.push_back(2);
    n = n / 2;
  }
  for (int i = 3; i <= sqrt(n); i = i + 2) {
    while (n % i == 0) {
      f.push_back(i);
      n /= i;
    }
  }
  if (n > 2) f.push_back(n);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    vector<long long int> f;
    primeFactors(n, f);
    long long int a = 1;
    for (int i = 1; i < (int)f.size(); ++i) {
      a *= f[i];
    }
    cout << a << " " << n - a << "\n";
  }
  return 0;
}
