import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

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

cnt = 0
for i in range(101, 0, -1):
    if a % i == 0 and b % i == 0:
        cnt += 1
    if cnt == k:
        print(i)
        exit() import sys sys sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline 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(101, 0, -1):
    if a % i == 0 and b % i == 0:
        cnt += 1
    if cnt == k:
        print(i)
        exit() i range(101, 0, -1) range 101 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)
        exit() cnt == k cnt k print(i) print i exit() exit input = sys.stdin.readline sys.stdin.readline input cnt = 0 0 cnt cnt += 1 1 cnt k = map(int, input().split()) map(int, input().split()) k a,b,k = map(int, input().split()) map(int, input().split()) a b,k = map(int, input().split()) map(int, input().split()) b
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

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

cnt = 0
for i in range(101, 0, -1):
    if a % i == 0 and b % i == 0:
        cnt += 1
    if cnt == k:
        print(i)
        exit()
