#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void program();
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  program();
}
const int MX = 5e5;
int testCases;
int n;
long long gcd(long long x, long long y) { return y == 0 ? x : gcd(y, x % y); }
long long lcm(long long x, long long y) { return x * y / gcd(x, y); }
bitset<MX> SIEVE;
vector<int> primes;
void findPrimes() {
  SIEVE[0] = SIEVE[1] = 1;
  for (int i = int(2); i < int(n + 1); i++) {
    if (SIEVE[i]) continue;
    primes.push_back(i);
    for (int j = 2 * i; j <= n; j += i) SIEVE[j] = 1;
  }
}
void program() {
  cin >> testCases;
  while (testCases--) {
    cin >> n;
    pair<int, int> p = {1, n - 1};
    long long best = n + 1;
    for (int i = int(2); i < int(sqrt(n) + 3); i++) {
      if (n % i != 0) continue;
      long long y = n / i;
      for (long long x = y; x < n; x += y) {
        long long a = x, b = n - x;
        long long l = lcm(a, b);
        if (l < best) {
          best = l;
          p = {a, b};
        }
      }
    }
    cout << p.first << " " << p.second << endl;
  }
}
