import java.io.*;
import java.util.StringTokenizer;

class Main{

static final PrintWriter out=new PrintWriter(System.out);

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int a=Integer.parseInt(st.nextToken());
int b=Integer.parseInt(st.nextToken());
out.println(gcd(Math.max(a,b),Math.min(a,b)));
out.flush();
}
}

private static long gcd(int a,int b){
if(b==0) return a;
return gcd(b,a%b);
}
} import java.io.*; io.* java import java.util.StringTokenizer; StringTokenizer java.util class Main{

static final PrintWriter out=new PrintWriter(System.out);

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int a=Integer.parseInt(st.nextToken());
int b=Integer.parseInt(st.nextToken());
out.println(gcd(Math.max(a,b),Math.min(a,b)));
out.flush();
}
}

private static long gcd(int a,int b){
if(b==0) return a;
return gcd(b,a%b);
}
} Main static final PrintWriter out=new PrintWriter(System.out); out new PrintWriter(System.out) public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int a=Integer.parseInt(st.nextToken());
int b=Integer.parseInt(st.nextToken());
out.println(gcd(Math.max(a,b),Math.min(a,b)));
out.flush();
}
} main {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int a=Integer.parseInt(st.nextToken());
int b=Integer.parseInt(st.nextToken());
out.println(gcd(Math.max(a,b),Math.min(a,b)));
out.flush();
}
} BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String line=""; line "" while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int a=Integer.parseInt(st.nextToken());
int b=Integer.parseInt(st.nextToken());
out.println(gcd(Math.max(a,b),Math.min(a,b)));
out.flush();
} (line=br.readLine())!=null&&!line.isEmpty() (line=br.readLine())!=null (line=br.readLine()) line br.readLine() br.readLine br null !line.isEmpty() line.isEmpty() line.isEmpty line {
StringTokenizer st=new StringTokenizer(line);
int a=Integer.parseInt(st.nextToken());
int b=Integer.parseInt(st.nextToken());
out.println(gcd(Math.max(a,b),Math.min(a,b)));
out.flush();
} StringTokenizer st=new StringTokenizer(line); st new StringTokenizer(line) int a=Integer.parseInt(st.nextToken()); a Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st int b=Integer.parseInt(st.nextToken()); b Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st out.println(gcd(Math.max(a,b),Math.min(a,b))) out.println out gcd(Math.max(a,b),Math.min(a,b)) gcd Math.max(a,b) Math.max Math a b Math.min(a,b) Math.min Math a b out.flush() out.flush out String[] args args private static long gcd(int a,int b){
if(b==0) return a;
return gcd(b,a%b);
} gcd {
if(b==0) return a;
return gcd(b,a%b);
} if(b==0) return a; b==0 b 0 return a; a return gcd(b,a%b); gcd(b,a%b) gcd b a%b a b int a a int b b
import java.io.*;
import java.util.StringTokenizer;

class Main{

static final PrintWriter out=new PrintWriter(System.out);

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int a=Integer.parseInt(st.nextToken());
int b=Integer.parseInt(st.nextToken());
out.println(gcd(Math.max(a,b),Math.min(a,b)));
out.flush();
}
}

private static long gcd(int a,int b){
if(b==0) return a;
return gcd(b,a%b);
}
}