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