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