#include<stdio.h> #include<algorithm> #include<iostream> #include<string.h> #include<stdio.h> using namespace std; int gcd(int a,int b) { if(a<b)swap(a,b); int t=b; while(t) { t=a%b; a=b; b=t; } return a; } int main() { int n,m; while(~scanf("%d%d",&n,&m)) { printf("%d\n",gcd(n,m)); } return 0; }