#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 2e5 + 5;
int __t = 1, n;
void solve() {
    cin >> n;
    int a = n / 2, b = n - a;
    while (__gcd(a, b) != 1)
        a--, b++;
    cout << a << ' ' << b << '\n';
    return;
}
int32_t main() {
#ifdef ONLINE_JUDGE
    ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cin >> __t;
    while (__t--)
        solve();
    return 0;
}