#!/usr/bin/env python3
a, b, k = map(int, open(0).read().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


x = divisor(a)
y = divisor(b)
print(sorted(list(x & y), reverse=True)[k-1]) a, b, k = map(int, open(0).read().split()) a map(int, open(0).read().split()) map int open(0).read().split() (0).read().split (0).read() (0).read (0) open 0 read 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 x = divisor(a) x divisor(a) divisor a y = divisor(b) y divisor(b) divisor b print(sorted(list(x & y), reverse=True)[k-1]) print sorted(list(x & y), reverse=True)[k-1] (list(x & y), reverse=True) sorted list(x & y) list x & y x y reverse=True reverse True k-1 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 = 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 y = divisor(b) divisor(b) y a, b, k = map(int, open(0).read().split()) map(int, open(0).read().split()) a b, k = map(int, open(0).read().split()) map(int, open(0).read().split()) b k = map(int, open(0).read().split()) map(int, open(0).read().split()) k x = divisor(a) divisor(a) x
#!/usr/bin/env python3
a, b, k = map(int, open(0).read().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


x = divisor(a)
y = divisor(b)
print(sorted(list(x & y), reverse=True)[k-1])
