#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
ll gcd2(ll a,ll b){
	while(b!=0){
		ll w=a%b;
		a=b;
		b=w;
	}
	return a;
}
int main(){
	int m,n;
	while(cin>>m>>n) cout<<gcd2(m,n)<<"\n";
	return 0;
}