uses crt;
var a,b:array[1..100]of integer;
n,i,j,ucln:integer;
begin
clrscr;
write('Nhap so cap:'); readln(n);
for i:=1 to n do
begin
readln(a[i],b[i]);
end;
for i:=1 to n do
begin
if a[i]<b[i] then
begin
ucln:=1;
for j:=1 to a[i] do
if (a[i] mod j=0) and (b[i] mod j=0) then
begin
if ucln<j then ucln:=j;
end;
end
else begin
ucln:=1;
for j:=1 to b[i] do
if (a[i] mod j=0) and (b[i] mod j=0) then
begin
if ucln<j then ucln:=j;
end;
end;
writeln('Uoc chung lon nhat cua cap thu ',i,' la: ',ucln);
end;
readln;
end.