#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t, n, i, j;
  cin >> t;
  while (t--) {
    cin >> n;
    if (n % 2 == 0) {
      cout << n / 2 << " " << n / 2;
    } else {
      for (i = 3, j = 0; i * i <= n; i++) {
        if (n % i == 0) {
          cout << n / i << " " << n - (n / i);
          j = 1;
          break;
        }
      }
      if (j == 0) cout << 1 << " " << n - 1;
    }
    printf("\n");
  }
}
