#include <iostream>
using namespace std;
int gcd(int x,int y);
int gcds(int a,int b,int c,int d);
int main()
{
int a,b,g,c,d,e;
cin>>a>>b>>c>>d;
g=gcd(a,b);
e=gcds(a,b,c,d);
cout<<g<<" "<<e;
return 0;
}
int gcd(int x,int y)
{
if (x%y==0)
return y;
else
return gcd(y,x%y);
}
int gcds(int a,int b,int c,int d)
{
gcd(gcd(a,b),gcd(c,d));
}
using namespace std;
int gcd(int x,int y);
int gcds(int a,int b,int c,int d);
int main()
{
int a,b,g,c,d,e;
cin>>a>>b>>c>>d;
g=gcd(a,b);
e=gcds(a,b,c,d);
cout<<g<<" "<<e;
return 0;
}
int gcd(int x,int y)
{
if (x%y==0)
return y;
else
return gcd(y,x%y);
}
int gcds(int a,int b,int c,int d)
{
gcd(gcd(a,b),gcd(c,d));
}