var count,x,y,target:longint;
begin
while not eof do begin
readln(x);
readln(y);
target:=0;
if x>y
then begin
for count:=1 to (y-1) do
begin
if ((x mod count)=0) and ((y mod count)=0)
then target:=count;
end;
end;
if y>x
then begin
for count:=1 to (x-1) do
begin
if ((x mod count)=0) and ((y mod count)=0)
then target:=count;
end;
end;
writeln(target);
end;
end.