#include<stdio.h>
#include<stdlib.h>
int gcd(int a,int b){
if (0==b){
return a;
}else{
return gcd(b,a%b);
}
}
int main(){
int a ,b;
while(scanf("%d%d",&a,&b)!=EOF){
printf("%d\n",gcd(a,b));
}
system("pause");
return 0;
}
#include<stdlib.h>
int gcd(int a,int b){
if (0==b){
return a;
}else{
return gcd(b,a%b);
}
}
int main(){
int a ,b;
while(scanf("%d%d",&a,&b)!=EOF){
printf("%d\n",gcd(a,b));
}
system("pause");
return 0;
}