c++
#include<stdio.h> int main() { int n,r,temp; while(scanf("%d%d",&n,&r)!=EOF) { while(n%r!=0) { temp=n%r; n=r; r=temp; } printf("%d\n",r); } }