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