#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> v;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    v.clear();
    for (int i = 1; i <= sqrt(n); i++) {
      if (n % i != 0) continue;
      int a = i, b = n - i;
      v.push_back({max(a, b), min(a, b)});
      a = n / i, b = n - n / i;
      v.push_back({max(a, b), min(a, b)});
    }
    sort(v.begin(), v.end());
    cout << v[0].second << " " << v[0].first << endl;
  }
}
