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

#約数取得
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

a_yakusu = make_divisors(a)
b_yakusu = make_divisors(b)
ab_yakusu = sorted(set(a_yakusu) & set(b_yakusu), reverse=True)

print(ab_yakusu[k-1]) a, b , k = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b k def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1] make_divisors lower_divisors , upper_divisors = [], [] lower_divisors [] upper_divisors [] i = 1 i 1 while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
     i*i <= n i*i i i n if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
         n % i == 0 n % i n i 0 lower_divisors.append(i) lower_divisors.append lower_divisors append i if i != n // i:
                upper_divisors.append(n//i)
         i != n // i i n // i n i upper_divisors.append(n//i) upper_divisors.append upper_divisors append n//i n i i += 1 i 1 return lower_divisors + upper_divisors[::-1] lower_divisors + upper_divisors[::-1] lower_divisors upper_divisors[::-1] upper_divisors ::-1 -1 n n a_yakusu = make_divisors(a) a_yakusu make_divisors(a) make_divisors a b_yakusu = make_divisors(b) b_yakusu make_divisors(b) make_divisors b ab_yakusu = sorted(set(a_yakusu) & set(b_yakusu), reverse=True) ab_yakusu sorted(set(a_yakusu) & set(b_yakusu), reverse=True) sorted set(a_yakusu) & set(b_yakusu) set(a_yakusu) set a_yakusu set(b_yakusu) set b_yakusu reverse=True reverse True print(ab_yakusu[k-1]) print ab_yakusu[k-1] ab_yakusu k-1 k 1 def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1] def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1] make_divisors a_yakusu = make_divisors(a) make_divisors(a) a_yakusu a, b , k = map(int, input().split()) map(int, input().split()) a b_yakusu = make_divisors(b) make_divisors(b) b_yakusu k = map(int, input().split()) map(int, input().split()) k ab_yakusu = sorted(set(a_yakusu) & set(b_yakusu), reverse=True) sorted(set(a_yakusu) & set(b_yakusu), reverse=True) ab_yakusu b , k = map(int, input().split()) map(int, input().split()) b
a, b , k = map(int, input().split())

#約数取得
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

a_yakusu = make_divisors(a)
b_yakusu = make_divisors(b)
ab_yakusu = sorted(set(a_yakusu) & set(b_yakusu), reverse=True)

print(ab_yakusu[k-1])
