#include <bits/stdc++.h>
using namespace std;
long long n,m,x,i;
//chuongtrinhcon
long long ucln(long long a,long long b)
{
if (b==0) return(a);
else return(ucln(b,a%b));
}
//chuongtrinhchinh
int main()
{
cin>>m>>n;
x=ucln(m,n);
for (i=1; i<=x; i++) if (x%i==0) cout<<i<<" ";
cout<<endl;
cout<<"Uoc chung lon nhat="<<x<<endl;
cout<<"Boi chung nho nhat="<<(m*n)/x<<endl;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long n,i,ucln,bcnn,m;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long n,m; cin>>n>>m;
ucln=__gcd(n,m); bcnn=n*m/ucln;
cout<<"a)\n";
cout<<"Tat ca cac uoc chung cua n va m la: ";
for(i=1;i<=sqrt(ucln);i++)
{
if(ucln%i==0)
{
cout<<i<<" ";
if(i*i!=ucln)
cout<<ucln/i<<" ";
}
}
cout<<"\nb)\n"<<"ucln la "<<ucln<<"\nbcnn la "<<bcnn;
return 0;
}