# 与えられた数値の桁数と桁値の総和を計算する.
def calc_digit_sum(num):
    digits = sums = 0
    while num > 0:
        digits += 1
        sums += num % 10
        num //= 10
    return digits, sums


cnt = 0
a, b, k = map(int, input().split())
for num in range(max(a, b), -1, -1):
    if a % num == 0 and b % num == 0:
        cnt += 1
        if k == cnt:
            print(num)
            exit() def calc_digit_sum(num):
    digits = sums = 0
    while num > 0:
        digits += 1
        sums += num % 10
        num //= 10
    return digits, sums calc_digit_sum digits = sums = 0 digits 0 = sums = 0 sums 0 while num > 0:
        digits += 1
        sums += num % 10
        num //= 10
     num > 0 num 0 digits += 1 digits 1 sums += num % 10 sums num % 10 num 10 num //= 10 num 10 return digits, sums return digits, sums digits sums num num cnt = 0 cnt 0 a, b, k = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b k for num in range(max(a, b), -1, -1):
    if a % num == 0 and b % num == 0:
        cnt += 1
        if k == cnt:
            print(num)
            exit() num range(max(a, b), -1, -1) range max(a, b) max a b -1 -1 if a % num == 0 and b % num == 0:
        cnt += 1
        if k == cnt:
            print(num)
            exit() a % num == 0 and b % num == 0 a % num == 0 a % num a num 0 b % num == 0 b % num b num 0 cnt += 1 cnt 1 if k == cnt:
            print(num)
            exit() k == cnt k cnt print(num) print num exit() exit def calc_digit_sum(num):
    digits = sums = 0
    while num > 0:
        digits += 1
        sums += num % 10
        num //= 10
    return digits, sums def calc_digit_sum(num):
    digits = sums = 0
    while num > 0:
        digits += 1
        sums += num % 10
        num //= 10
    return digits, sums calc_digit_sum cnt = 0 0 cnt cnt += 1 1 cnt 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
# 与えられた数値の桁数と桁値の総和を計算する.
def calc_digit_sum(num):
    digits = sums = 0
    while num > 0:
        digits += 1
        sums += num % 10
        num //= 10
    return digits, sums


cnt = 0
a, b, k = map(int, input().split())
for num in range(max(a, b), -1, -1):
    if a % num == 0 and b % num == 0:
        cnt += 1
        if k == cnt:
            print(num)
            exit()