#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5;
void solve() {
  int n;
  cin >> n;
  int mm;
  for (mm = 2; mm < maxn; mm++) {
    if (n % mm == 0) break;
  }
  if (mm == maxn) {
    cout << 1 << ' ' << n - 1 << endl;
    return;
  }
  cout << (n / mm) << ' ' << (mm - 1) * (n / mm) << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
