#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 x = 0;
      for (int i = 3; i <= sqrt(n); i = i + 2) {
        if (n % i == 0) {
          x = i;
          break;
        }
      }
      int a, b;
      if (x == 0) {
        a = 1;
        b = n - 1;
      } else {
        a = n / x;
        b = n - a;
      }
      cout << a << " " << b << endl;
    }
  }
}
