a,b,k = map(int,input().split())
n=max(a,b)
A=[]
for i in range(1,n+1):
    if  a%i==b%i==0:
         A.append(i)
A.sort(reverse = True)

print(A[k-1]) a,b,k = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b k n=max(a,b) n max(a,b) max a b A=[] A [] for i in range(1,n+1):
    if  a%i==b%i==0:
         A.append(i) i range(1,n+1) range 1 n+1 n 1 if  a%i==b%i==0:
         A.append(i) a%i==b%i==0 a%i==b%i a%i a i b%i b i 0 A.append(i) A.append A append i A.sort(reverse = True) A.sort A sort reverse = True reverse True print(A[k-1]) print A[k-1] A k-1 k 1 k = map(int,input().split()) map(int,input().split()) k A=[] [] A a,b,k = map(int,input().split()) map(int,input().split()) a b,k = map(int,input().split()) map(int,input().split()) b n=max(a,b) max(a,b) n
a,b,k = map(int,input().split())
n=max(a,b)
A=[]
for i in range(1,n+1):
    if  a%i==b%i==0:
         A.append(i)
A.sort(reverse = True)

print(A[k-1])
