#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  if (n % 2 == 0)
    cout << n / 2 << " " << n / 2 << '\n';
  else {
    int h = 1;
    for (int i = 2; i * i <= n; i++) {
      if (n % i == 0) {
        h = n / i;
        break;
      }
    }
    cout << h << " " << n - h << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long testCases = 1;
  cin >> testCases;
  while (testCases--) {
    solve();
  }
  return 0;
}
