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, B, K = map(int, input().split())

set_a = set(make_divisors(A))
set_b = set(make_divisors(B))
set_ab = set_a.intersection(set_b)

list_ab = list(set_ab)
list_ab.sort()
# print(list_ab)

print(list_ab[-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, B, K = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B K set_a = set(make_divisors(A)) set_a set(make_divisors(A)) set make_divisors(A) make_divisors A set_b = set(make_divisors(B)) set_b set(make_divisors(B)) set make_divisors(B) make_divisors B set_ab = set_a.intersection(set_b) set_ab set_a.intersection(set_b) set_a.intersection set_a intersection set_b list_ab = list(set_ab) list_ab list(set_ab) list set_ab list_ab.sort() list_ab.sort list_ab sort print(list_ab[-K]) print list_ab[-K] list_ab -K K K = map(int, input().split()) map(int, input().split()) K set_b = set(make_divisors(B)) set(make_divisors(B)) set_b A, B, K = map(int, input().split()) map(int, input().split()) A B, K = map(int, input().split()) map(int, input().split()) B 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 set_a = set(make_divisors(A)) set(make_divisors(A)) set_a set_ab = set_a.intersection(set_b) set_a.intersection(set_b) set_ab list_ab = list(set_ab) list(set_ab) list_ab
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, B, K = map(int, input().split())

set_a = set(make_divisors(A))
set_b = set(make_divisors(B))
set_ab = set_a.intersection(set_b)

list_ab = list(set_ab)
list_ab.sort()
# print(list_ab)

print(list_ab[-K])