gcd(a, b) + lcm(a, b) = x then a = ? and b = ?

// if x = 24 then
//gcd(1, 23) = 1 and lcm(1, 23) = 23
//so a = 1 and b = 23

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t, n, i;
    cin >> t;
    while(t--)
    {
        cin >> n;
        cout << 1 << " " << n-1 << "\n";
    }

    return 0;
}

Comments