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

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

count = 0
for i in range(1, 100):
    if A % i == 0:
        sho = A / i
        if B % sho == 0:
            count += 1
    if count == K:
        print(int(sho))
        break