#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
using pcc = pair<char, char>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<ll>;
using vpii = vector<pii>;
using vc = vector<char>;
using vd = vector<double>;
template <typename T>
T POW(T a, T b) {
  T x = 1;
  while (b) {
    if (b & 1) x *= a;
    a *= a;
    b >>= 1;
  }
  return x;
}
template <typename T>
T mPOW(T a, T b, T M) {
  T x = 1;
  while (b) {
    if (b & 1) x = (x * a) % M;
    a = (a * a) % M;
    b >>= 1;
  }
  return x;
}
template <typename T>
T Sqrt(T a) {
  T x = (T)sqrt(a);
  if ((x + 1) * (x + 1) == a) x++;
  return x;
}
int main(int argc, char *argv[]) {
  int testcase, cs = 1;
  cin >> testcase;
  while (testcase--) {
    ll n;
    scanf("%lld%*c", &(n));
    if (n % 2 == 0) {
      printf("%lld %lld", (n / 2), (n / 2));
      printf("\n");
    } else {
      ll i;
      for (i = 3; i * i <= n; i += 2) {
        if (n % i == 0) break;
      }
      if (i * i <= n) {
        printf("%lld %lld\n", n / i, n - (n / i));
      } else {
        printf("1 %lld\n", n - 1);
      }
    }
  }
  return 0;
}
