A,B,K = map(int,input().split())

count = 0
import math
R = []
for i in range(1,int(math.sqrt(A))+1+1):
    if A%i == 0:
        R.append(i)
        if not i == A//i:
            R.append(A//i)
R.sort(reverse=True)
for r in R:
    if B%r==0:
        count+=1
        if count == K:
            print(r)


 A,B,K = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B K count = 0 count 0 import math math R = [] R [] for i in range(1,int(math.sqrt(A))+1+1):
    if A%i == 0:
        R.append(i)
        if not i == A//i:
            R.append(A//i) i range(1,int(math.sqrt(A))+1+1) range 1 int(math.sqrt(A))+1+1 int(math.sqrt(A))+1 int(math.sqrt(A)) int math.sqrt(A) math.sqrt math sqrt A 1 1 if A%i == 0:
        R.append(i)
        if not i == A//i:
            R.append(A//i) A%i == 0 A%i A i 0 R.append(i) R.append R append i if not i == A//i:
            R.append(A//i) not i == A//i i == A//i i A//i A i R.append(A//i) R.append R append A//i A i R.sort(reverse=True) R.sort R sort reverse=True reverse True for r in R:
    if B%r==0:
        count+=1
        if count == K:
            print(r) r R if B%r==0:
        count+=1
        if count == K:
            print(r) B%r==0 B%r B r 0 count+=1 count 1 if count == K:
            print(r) count == K count K print(r) print r A,B,K = map(int,input().split()) map(int,input().split()) A count+=1 1 count count = 0 0 count R = [] [] R B,K = map(int,input().split()) map(int,input().split()) B K = map(int,input().split()) map(int,input().split()) K
A,B,K = map(int,input().split())

count = 0
import math
R = []
for i in range(1,int(math.sqrt(A))+1+1):
    if A%i == 0:
        R.append(i)
        if not i == A//i:
            R.append(A//i)
R.sort(reverse=True)
for r in R:
    if B%r==0:
        count+=1
        if count == K:
            print(r)



