#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 5;
template <class T>
void print(T& x) {
  cout << x;
}
template <class T, class U>
void print(pair<T, U>& p) {
  cout << "(";
  print(p.first);
  cout << ", ";
  print(p.second);
  cout << ")";
}
template <class T>
void print(vector<T>& v) {
  cout << "{";
  if (((int)(v).size())) print(v[0]);
  for (int i = 1; i < ((int)(v).size()); i++) cout << ", ", print(v[i]);
  cout << "}\n";
}
long long n, m, T;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> T;
  while (T--) {
    cin >> n;
    long long ans = 1;
    for (long long i = 2; i * i <= n; ++i) {
      if (n % i == 0) {
        ans = max(ans, max(i, n / i));
      }
    }
    cout << ans << " " << (n / ans - 1) * ans << endl;
  }
  return 0;
}
