
#include <iostream>
using namespace std;

int main() {
    
    int a,b;
    while(cin >> a >> b){
        for(int i = a;i > 1;i--){
            if(b%i == 0 && a%i == 0){
                cout << i << "\n";
                break;
            }
        }
        for(int i = a;i < 2000000000;i++){
            if(i%a == 0 && i%b == 0){
                cout << i << "\n";
                break;
            }
        }
    }
    
return 0;
}