#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    if (n % 2 == 0)
      cout << n / 2 << " " << n / 2 << endl;
    else {
      int m = 0;
      for (int i = 1; i <= sqrt(n); i++) {
        if (n % i == 0) {
          if (n - i >= n / 2 && m < i) m = i;
          if (n - n / i >= n / 2 && m < n / i) m = n / i;
        }
      }
      cout << m << " " << n - m << endl;
    }
  }
}
