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

a , b , k = map(int,input().split())
cou = 0
for i in reversed(range(1,101)):
    if a % i == 0 and b % i == 0:
        cou += 1
    if cou == k:
        print(i)
        exit()