import sys
A,B,K = map(int,input().split())
#euclid algorithm
if A < B: 
    A, B = B, A
while A%B != 0:
    A,B = B,A%B

count = 0
for I in range(B,0,-1):
    if B % I == 0:
        count += 1
    if count == K:
        print(I)
        break import sys sys A,B,K = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B K if A < B: 
    A, B = B, A A < B A B A, B = B, A A B B A while A%B != 0:
    A,B = B,A%B A%B != 0 A%B A B 0 A,B = B,A%B A B B A%B A B count = 0 count 0 for I in range(B,0,-1):
    if B % I == 0:
        count += 1
    if count == K:
        print(I)
        break I range(B,0,-1) range B 0 -1 if B % I == 0:
        count += 1
     B % I == 0 B % I B I 0 count += 1 count 1 if count == K:
        print(I)
        break count == K count K print(I) print I break K = map(int,input().split()) map(int,input().split()) K B,K = map(int,input().split()) map(int,input().split()) B A,B = B,A%B B A count += 1 1 count B = B, A A B count = 0 0 count A, B = B, A B A A,B,K = map(int,input().split()) map(int,input().split()) A B = B,A%B A%B B
import sys
A,B,K = map(int,input().split())
#euclid algorithm
if A < B: 
    A, B = B, A
while A%B != 0:
    A,B = B,A%B

count = 0
for I in range(B,0,-1):
    if B % I == 0:
        count += 1
    if count == K:
        print(I)
        break
