#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int T;
  cin >> T;
  while (T--) {
    int n;
    cin >> n;
    int k = sqrt(n);
    int a = 1, b = n - 1;
    for (int i = 1; i <= k; ++i) {
      if (n % (i + 1) == 0) {
        int at = n / (i + 1);
        int bt = i * at;
        if (bt < b) {
          a = at;
          b = bt;
        }
      }
    }
    cout << a << " " << b << '\n';
  }
  return 0;
}
