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_d = set(make_divisors(a))
b_d = set(make_divisors(b))
d = sorted(list(a_d & b_d), reverse=True)

print(d[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_d = set(make_divisors(a)) a_d set(make_divisors(a)) set make_divisors(a) make_divisors a b_d = set(make_divisors(b)) b_d set(make_divisors(b)) set make_divisors(b) make_divisors b d = sorted(list(a_d & b_d), reverse=True) d sorted(list(a_d & b_d), reverse=True) sorted list(a_d & b_d) list a_d & b_d a_d b_d reverse=True reverse True print(d[k-1]) print d[k-1] d k-1 k 1 b, k = map(int, input().split()) map(int, input().split()) b k = map(int, input().split()) map(int, input().split()) 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] 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_d = set(make_divisors(a)) set(make_divisors(a)) a_d b_d = set(make_divisors(b)) set(make_divisors(b)) b_d d = sorted(list(a_d & b_d), reverse=True) sorted(list(a_d & b_d), reverse=True) d a, b, k = map(int, input().split()) map(int, input().split()) a
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_d = set(make_divisors(a))
b_d = set(make_divisors(b))
d = sorted(list(a_d & b_d), reverse=True)

print(d[k-1])