a, b, k = map(int, input().split(' '))
count = 0
for i in range(min(a,b),0,-1):
    if (a%i == 0) and (b%i == 0):
        count+=1
    if count == k:
        print(i)
        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(min(a,b),0,-1):
    if (a%i == 0) and (b%i == 0):
        count+=1
    if count == k:
        print(i)
        break i range(min(a,b),0,-1) range min(a,b) min a b 0 -1 if (a%i == 0) and (b%i == 0):
        count+=1
     (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 a, b, k = map(int, input().split(' ')) map(int, input().split(' ')) a 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(min(a,b),0,-1):
    if (a%i == 0) and (b%i == 0):
        count+=1
    if count == k:
        print(i)
        break
