#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 100005;
signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base ::sync_with_stdio(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long mn = -1;
    for (long long i = 2; i * i <= n + 10; i++) {
      if (n % i == 0) {
        mn = i;
        break;
      }
    }
    if (mn == -1) {
      mn = n;
    }
    cout << n / mn << ' ' << n - n / mn << '\n';
  }
  return 0;
}
