A, B, K = map(int, input().split())
a = []
b = []

for x in range(1, A + 1):
    if A % x == 0:
        a.append(x)

for y in range(1, B + 1):
    if B % y == 0 and y in a:
        b.append(y)

b = sorted(b,reverse = True)

print(b[K - 1]) A, B, K = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B K a = [] a [] b = [] b [] for x in range(1, A + 1):
    if A % x == 0:
        a.append(x) x range(1, A + 1) range 1 A + 1 A 1 if A % x == 0:
        a.append(x) A % x == 0 A % x A x 0 a.append(x) a.append a append x for y in range(1, B + 1):
    if B % y == 0 and y in a:
        b.append(y) y range(1, B + 1) range 1 B + 1 B 1 if B % y == 0 and y in a:
        b.append(y) B % y == 0 and y in a B % y == 0 B % y B y 0 y in a y a b.append(y) b.append b append y b = sorted(b,reverse = True) b sorted(b,reverse = True) sorted b reverse = True reverse True print(b[K - 1]) print b[K - 1] b K - 1 K 1 b = [] [] b A, B, K = map(int, input().split()) map(int, input().split()) A a = [] [] a b = sorted(b,reverse = True) sorted(b,reverse = True) b 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())
a = []
b = []

for x in range(1, A + 1):
    if A % x == 0:
        a.append(x)

for y in range(1, B + 1):
    if B % y == 0 and y in a:
        b.append(y)

b = sorted(b,reverse = True)

print(b[K - 1])