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

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

cnt = 0
for i in range(A, 0, -1):
    if A % i == 0 and B % i == 0:
        cnt += 1
        if cnt == K:
            print(i)
            exit()
