#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int Q;
  cin >> Q;
  while (Q--) {
    int n;
    cin >> n;
    bool isprime = true;
    for (int i = 2; i * i <= n; i++) {
      if (n % i == 0) {
        cout << n / i << " " << n - n / i << "\n";
        isprime = false;
        break;
      }
    }
    if (isprime) cout << 1 << ' ' << n - 1 << '\n';
  }
}
