#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    int test; cin >> test;
    while(test--){
        ll a, b; cin >> a >> b;
        ll x = a * b;
        while(b != 0){
            ll temp = a % b;
            a = b;
            b = temp;
        }
        ll y = x/a;
        cout << "UCLN: " << a << "\n";
        cout << "BCNN: " << y << "\n";
        cout << "\n";
    }
}