#include <bits/stdc++.h>
using namespace std;
long long int mod = 998244353;
using namespace std;
long long int t, n, u, x, y;
const long long int N = 100001;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  t = 1;
  cin >> t;
  while (t--) {
    cin >> n;
    long long int ans = -1;
    if (n % 2 == 0) {
      cout << n / 2 << " " << n / 2 << endl;
      continue;
    }
    for (long long int i = 2; i <= sqrt(n); ++i) {
      if (n % i == 0) {
        ans = n / i;
        break;
      }
    }
    if (ans == -1)
      cout << n - 1 << " " << 1 << endl;
    else
      cout << ans << " " << n - ans << endl;
  }
}
