#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    if (n % 2 == 0)
      cout << n / 2 << " " << n / 2 << "\n";
    else {
      long long int x = -1;
      for (long long int i = 3; i <= sqrt(n); i += 2) {
        if (n % i == 0) {
          x = i;
          break;
        }
      }
      if (x == -1)
        cout << n - 1 << " " << 1 << "\n";
      else {
        long long int y = n / x;
        cout << y * 1 << " " << y * (x - 1) << "\n";
      }
    }
  }
}
