a,b,k = map(int,input().split())
i = 101
j = 0
while True:
    i -= 1
    if a % i == 0 and b % i == 0:
        j += 1
        if j == 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 i = 101 i 101 j = 0 j 0 while True:
    i -= 1
    if a % i == 0 and b % i == 0:
        j += 1
        if j == k:
            print(i)
            break True i -= 1 i 1 if a % i == 0 and b % i == 0:
        j += 1
        if j == k:
            print(i)
            break a % i == 0 and b % i == 0 a % i == 0 a % i a i 0 b % i == 0 b % i b i 0 j += 1 j 1 if j == k:
            print(i)
            break j == k j k print(i) print i break a,b,k = map(int,input().split()) map(int,input().split()) a j = 0 0 j b,k = map(int,input().split()) map(int,input().split()) b k = map(int,input().split()) map(int,input().split()) k i = 101 101 i j += 1 1 j i -= 1 1 i
a,b,k = map(int,input().split())
i = 101
j = 0
while True:
    i -= 1
    if a % i == 0 and b % i == 0:
        j += 1
        if j == k:
            print(i)
            break