#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int a = 1, b = n - 1, k;
    for (int i = 2; i * i <= n; i++) {
      if (n % i == 0) {
        a = n / i;
        b = n - a;
        break;
      }
    }
    cout << a << " " << b << endl;
  }
}
