A,B,K = list(map(int,input().split()))
count = 0
for i in range(100, 0, -1):
    if A % i == 0 and B % i == 0:
        count += 1
        if count == K:
            print(i)
            break A,B,K = list(map(int,input().split())) A list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split B K count = 0 count 0 for i in range(100, 0, -1):
    if A % i == 0 and B % i == 0:
        count += 1
        if count == K:
            print(i)
            break i range(100, 0, -1) range 100 0 -1 if A % i == 0 and B % i == 0:
        count += 1
        if count == 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 count += 1 count 1 if count == K:
            print(i)
            break count == K count K print(i) print i break count = 0 0 count count += 1 1 count B,K = list(map(int,input().split())) list(map(int,input().split())) B K = list(map(int,input().split())) list(map(int,input().split())) K A,B,K = list(map(int,input().split())) list(map(int,input().split())) A
A,B,K = list(map(int,input().split()))
count = 0
for i in range(100, 0, -1):
    if A % i == 0 and B % i == 0:
        count += 1
        if count == K:
            print(i)
            break