#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define vint vector<int>

int gcd(int a, int b){return b ? gcd(b,a%b):a;}

int main(){
    int a,b;
    while(~scanf("%d%d",&a,&b)) {
        cout << gcd(a,b) << endl;
    }

    return 0;
}