#include <bits/stdc++.h>
const long long INF = 1e9;
const long long MAXN = 1e5 + 5;
const long long MOD = 1e9 + 7;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n, flag = 0;
    cin >> n;
    if (n % 2 == 0)
      cout << n / 2 << " " << n / 2 << endl;
    else {
      for (long long i = 2; i * i <= n; i++)
        if (n % i == 0) {
          cout << n / i << " " << n - (n / i) << endl;
          flag = 1;
          break;
        }
      if (flag == 0)
        cout << "1"
             << " " << n - 1 << endl;
    }
  }
}
