A, B, K = [int(i) for i in input().split()]
result_list = []

def divisor_list(n):
    i = 1
    array = []
    while i * i <= n:
        if n % i == 0:
            array.append(i)
            array.append(n//i)
        i += 1
    array = list(set(array))
    return array

for i in divisor_list(A):
    for j in divisor_list(B):
        if i == j:
            result_list.append(i)

print(sorted(result_list)[-K]) int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i A, B, K = [int(i) for i in input().split()] A [int(i) for i in input().split()] B K result_list = [] result_list [] def divisor_list(n):
    i = 1
    array = []
    while i * i <= n:
        if n % i == 0:
            array.append(i)
            array.append(n//i)
        i += 1
    array = list(set(array))
    return array divisor_list i = 1 i 1 array = [] array [] while i * i <= n:
        if n % i == 0:
            array.append(i)
            array.append(n//i)
        i += 1
     i * i <= n i * i i i n if n % i == 0:
            array.append(i)
            array.append(n//i)
         n % i == 0 n % i n i 0 array.append(i) array.append array append i array.append(n//i) array.append array append n//i n i i += 1 i 1 array = list(set(array)) array list(set(array)) list set(array) set array return array array n n for i in divisor_list(A):
    for j in divisor_list(B):
        if i == j:
            result_list.append(i) i divisor_list(A) divisor_list A for j in divisor_list(B):
        if i == j:
            result_list.append(i) j divisor_list(B) divisor_list B if i == j:
            result_list.append(i) i == j i j result_list.append(i) result_list.append result_list append i print(sorted(result_list)[-K]) print sorted(result_list)[-K] (result_list) sorted result_list -K K B, K = [int(i) for i in input().split()] [int(i) for i in input().split()] B def divisor_list(n):
    i = 1
    array = []
    while i * i <= n:
        if n % i == 0:
            array.append(i)
            array.append(n//i)
        i += 1
    array = list(set(array))
    return array def divisor_list(n):
    i = 1
    array = []
    while i * i <= n:
        if n % i == 0:
            array.append(i)
            array.append(n//i)
        i += 1
    array = list(set(array))
    return array divisor_list K = [int(i) for i in input().split()] [int(i) for i in input().split()] K A, B, K = [int(i) for i in input().split()] [int(i) for i in input().split()] A result_list = [] [] result_list
A, B, K = [int(i) for i in input().split()]
result_list = []

def divisor_list(n):
    i = 1
    array = []
    while i * i <= n:
        if n % i == 0:
            array.append(i)
            array.append(n//i)
        i += 1
    array = list(set(array))
    return array

for i in divisor_list(A):
    for j in divisor_list(B):
        if i == j:
            result_list.append(i)

print(sorted(result_list)[-K])