#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
const long long INF = LLONG_MAX / 2;
const long long N = 2e5 + 1;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long first = n;
    for (long long i = 2; i * i <= n; i++)
      if (n % i == 0) {
        first = i;
        break;
      }
    cout << n / first << " " << n - n / first << '\n';
  }
  return 0;
}
