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

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

print(sorted(list(set(divisor(A)) & set(divisor(B))), reverse=True)[K-1]) A, B, K = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B K 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 print(sorted(list(set(divisor(A)) & set(divisor(B))), reverse=True)[K-1]) print sorted(list(set(divisor(A)) & set(divisor(B))), reverse=True)[K-1] (list(set(divisor(A)) & set(divisor(B))), reverse=True) sorted list(set(divisor(A)) & set(divisor(B))) list set(divisor(A)) & set(divisor(B)) set(divisor(A)) set divisor(A) divisor A set(divisor(B)) set divisor(B) divisor B reverse=True reverse True 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 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, B, K = map(int, input().split()) map(int, input().split()) A
A, B, K = map(int, input().split())

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

print(sorted(list(set(divisor(A)) & set(divisor(B))), reverse=True)[K-1])
