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