#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e5 + 3;
;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int largest = 1;
    if (n % 2 == 0) largest = 2;
    if (largest == 2) {
      cout << n / 2 << " " << n / 2 << endl;
    } else {
      bool prime = true;
      for (long long int i = 3; i <= sqrt(n); i += 2) {
        if (n % i == 0) {
          long long int k = n / i;
          cout << k << " " << n - k << endl;
          prime = false;
          break;
        }
      }
      if (prime) cout << 1 << " " << n - 1 << endl;
    }
  }
  return 0;
}
