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

A, B, K = map(int, input().split(" "))

a_divisor = divisor(A)
b_divisor = divisor(B)

print(sorted(list(set(a_divisor) & set(b_divisor)), reverse=True)[K-1]) def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table divisor i = 1 i 1 table = [] table [] while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
     i * i <= n i * i i i n if n % i == 0:
            table.append(i)
            table.append(n//i)
         n % i == 0 n % i n i 0 table.append(i) table.append table append i table.append(n//i) table.append table append n//i n i i += 1 i 1 table = list(set(table)) table list(set(table)) list set(table) set table return table table n n A, B, K = map(int, input().split(" ")) A map(int, input().split(" ")) map int input().split(" ") ().split () input split " " B K a_divisor = divisor(A) a_divisor divisor(A) divisor A b_divisor = divisor(B) b_divisor divisor(B) divisor B print(sorted(list(set(a_divisor) & set(b_divisor)), reverse=True)[K-1]) print sorted(list(set(a_divisor) & set(b_divisor)), reverse=True)[K-1] (list(set(a_divisor) & set(b_divisor)), reverse=True) sorted list(set(a_divisor) & set(b_divisor)) list set(a_divisor) & set(b_divisor) set(a_divisor) set a_divisor set(b_divisor) set b_divisor reverse=True reverse True K-1 K 1 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 b_divisor = divisor(B) divisor(B) b_divisor def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table divisor a_divisor = divisor(A) divisor(A) a_divisor
def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table

A, B, K = map(int, input().split(" "))

a_divisor = divisor(A)
b_divisor = divisor(B)

print(sorted(list(set(a_divisor) & set(b_divisor)), reverse=True)[K-1])