/*
import java.util.*;
class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
double [] a = new double[1000001], memo = new double[1000001];
double a1,max=-1;
if(n!=1) {
for(int i=0;i<n;i++) {
a[i]=sc.nextDouble();
}
for(int i=0;i<n;i++) {
memo[0]=a[0];
if(memo[i]*a[i+1]>a[i+1]) memo[i+1]=memo[i]*a[i+1];
else memo[i+1]=a[i+1];
if(memo[i]>max) {
max= memo[i];
}
}
System.out.printf("%.3f",max);
}
else {
a1=sc.nextDouble();
System.out.printf("%.3f",a1);
}
}
}
*/
/*
import java.util.*;
class Main{
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
int n=sc.nextInt(), m=sc.nextInt(), t=0;
int [] arrN = new int[1000001];
int [] arrMA = new int[100000], arrMB = new int[100000];
for(int i=1;i<=n;i++) {
arrN[i]=sc.nextInt();
}
for(int i=1;i<=m;i++) {
arrMA[i]=sc.nextInt();
arrMB[i]=sc.nextInt();
}
for(int i=1;i<=m;i++) {
t=0;
for(int j=arrMA[i]; j<=arrMB[i];j++) {
t+=arrN[j];
}
System.out.println(t);
}
}
}
*/
// 2635 4062 4727 2055 2640
/*
*
* n의 약수를 구할때, 1 ~ n (x)
* 14 -> 3.xx
* 1 2 7 14
*/
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
int a=sc.nextInt(),b=sc.nextInt();
int n=sc.nextInt() ;
for(int i=1,j=1; i<=Math.sqrt(a)||j<=Math.sqrt(b); i++,j++) {
if(a%i==0&&b%i==0) {
System.out.print(i);
}
if(a%i==0&&b%i!=0) {
System.out.print(i+" "+a/i);
}
if( b%i==0&&a%i!=0) {
System.out.print(i+" "+b/i);
}
}
}
}