#include <bits/stdc++.h>
using namespace std;
int T, n;
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    int cur = 1;
    for (int i = 2; i <= sqrt(n); i++)
      if (n % i == 0) {
        cur = n / i;
        break;
      }
    printf("%d %d\n", cur, cur * (n / cur - 1));
  }
  return 0;
}
