def LI():return map(int,input().split())
def I(): return input().split()

a,b,k=LI()
cnt=0
for i in range(100,0,-1):
    if a % i ==0 and b % i==0:
        cnt+=1
        if cnt==k:
            print(i)
            break def LI():return map(int,input().split()) LI def I(): return input().split() I a,b,k=LI() a LI() LI b k cnt=0 cnt 0 for i in range(100,0,-1):
    if a % i ==0 and b % i==0:
        cnt+=1
        if cnt==k:
            print(i)
            break i range(100,0,-1) range 100 0 -1 if a % i ==0 and b % i==0:
        cnt+=1
        if cnt==k:
            print(i)
            break a % i ==0 and b % i==0 a % i ==0 a % i a i 0 b % i==0 b % i b i 0 cnt+=1 cnt 1 if cnt==k:
            print(i)
            break cnt==k cnt k print(i) print i break k=LI() LI() k b,k=LI() LI() b cnt+=1 1 cnt def LI():return map(int,input().split()) def LI():return map(int,input().split()) LI cnt=0 0 cnt def I(): return input().split() def I(): return input().split() I a,b,k=LI() LI() a
def LI():return map(int,input().split())
def I(): return input().split()

a,b,k=LI()
cnt=0
for i in range(100,0,-1):
    if a % i ==0 and b % i==0:
        cnt+=1
        if cnt==k:
            print(i)
            break