#include <bits/stdc++.h>
using namespace std;
template <typename T, typename V>
ostream& operator<<(ostream& os, const pair<T, V>& p) {
  os << "{" << p.first << ", " << p.second << "}";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "[ ";
  for (T e : v) os << e << " ";
  os << "]"
     << "\n";
  return os;
}
template <typename T, typename V>
ostream& operator<<(ostream& os, const map<T, V>& mp) {
  os << "[ "
     << "\n";
  for (auto x : mp) os << x << "\n";
  os << " ]"
     << "\n";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& v) {
  os << "[ ";
  for (T e : v) os << e << " ";
  os << "]"
     << "\n";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, const multiset<T>& v) {
  os << "[ ";
  for (T e : v) os << e << " ";
  os << "]"
     << "\n";
  return os;
}
template <typename T, typename V>
istream& operator>>(istream& is, pair<T, V>& p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
  for (int i = 0; i < v.size(); i++) is >> v[i];
  return is;
}
map<long long int, pair<long long int, long long int>> mp;
void solve() {
  long long int n;
  cin >> n;
  if (mp.find(n) != mp.end()) {
    cout << mp[n].first << " " << mp[n].second << "\n";
    return;
  }
  long long int f = 1;
  for (long long int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      f = i;
      break;
    }
  }
  if (f == 1) {
    mp[n] = {1, n - 1};
    cout << 1 << " " << n - 1 << "\n";
    return;
  }
  long long int a = n / f;
  long long int b = n - (n / f);
  mp[n] = {a, b};
  cout << a << " " << b << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
