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