a,b,k = map(int,input().split())

n = min(a,b)

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

n = min(a,b)

count = 0
for i in reversed(range(1,n+1)):
    if a % i == 0 and b % i == 0:
        count += 1
    if count == k:
        print(i)
        break