문제
풀이
#include <iostream>
using namespace std;
int gcd(int a, int b) {
return b ? gcd(b, a % b) : a;
}
void solve(void) {
int a, b; cin >> a >> b;
int g = gcd(a, b);
cout << a / g << " " << b / g << "\n";
}
int main(void) {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n; cin >> n;
while (n--) solve();
return 0;
}