#include <bits/stdc++.h>
using namespace std;
const int N = 31625;
vector<int> primes;
void sieve() {
  bitset<N> p;
  for (int i = 2; i <= sqrt(N); i++)
    for (int j = i * i; j < N; j += i) p[j] = 1;
  for (int i = 2; i < N; i++)
    if (!p[i]) primes.push_back(i);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  sieve();
  int t, n;
  cin >> t;
  while (t--) {
    cin >> n;
    int factor = 1, ans = 1;
    for (int prime : primes) {
      while (n % prime == 0) {
        if (factor == 1) factor = prime;
        ans *= prime;
        n /= prime;
      }
      if (n == 1) break;
    }
    ans *= n;
    ans /= factor;
    if (factor == 1)
      printf("1 %d\n", ans - 1);
    else
      printf("%d %d\n", ans, ans * (factor - 1));
  }
  return 0;
}
