#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t, n, i, a, b, temp;
  cin >> t;
  while (t--) {
    long long int mini = 1000000007;
    cin >> n;
    if (n % 2 == 0)
      cout << n / 2 << " " << n / 2 << "\n";
    else {
      for (i = 1; i * i <= n; i++) {
        temp = i;
        if (n % temp == 0 && ((n - temp) % temp == 0) &&
            max(temp, n - temp) < mini) {
          a = temp;
          b = n - temp;
          mini = max(n - temp, temp);
        }
        if (n % temp == 0) {
          temp = n / temp;
          if (((n - temp) % temp == 0) && max(temp, n - temp) < mini) {
            a = temp;
            b = n - temp;
            mini = max(temp, n - temp);
          }
        }
      }
      cout << a << " " << b << "\n";
    }
  }
  return 0;
}
