program uocchung;
uses crt;
var a,b,i:longint;
begin
clrscr;
write('Nhap a: '); readln(a);
write('Nhap b: '); readln(b);
if a<b then
for i:=1 to a do
if (a mod i=0) and (b mod i=0) then write(i,' ');
if a>=b then
for i:=1 to b do
if (a mod i=0) and (b mod i=0) then write(i,' ');
readln
end.