#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1000000007;
const long long int INF = 1e18;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    bool ok = 0;
    for (int i = 2; i <= sqrt(n); i++) {
      if (n % i == 0) {
        cout << n / i << ' ' << n - (n / i) << endl;
        ok = 1;
        break;
      }
    }
    if (!ok) {
      cout << 1 << ' ' << n - 1 << endl;
    }
  }
  return 0;
}
