#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 10;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
int n, m, k;
int a[N];
int gcd(int x, int y) { return x % y ? gcd(y, x % y) : y; }
int main() {
  long long T = 1, x, y, rt;
  cin >> T;
  while (T--) {
    cin >> n;
    int l, mx = inf;
    for (int i = 1; i <= sqrt(n); i++) {
      x = n / i, y = n - x;
      if (x == 0 || y == 0) continue;
      long long g = 1ll * x * y / gcd(x, y);
      if (mx > g) {
        mx = g;
        l = i;
      }
    }
    if (mx > n - 1) {
      mx = n - 1;
      l = n;
    }
    cout << n / l << " " << n - n / l << endl;
  }
  return 0;
}
