def com_div(x, y):
    dv = []
    m = min(x, y)
    for i in range(1, m + 1):
        if x % i == 0 and y % i == 0:
            dv.append(i)
    dv.sort()
    return dv[::-1]


a, b, k = list(map(int, input().split()))
print(com_div(a, b)[k - 1]) def com_div(x, y):
    dv = []
    m = min(x, y)
    for i in range(1, m + 1):
        if x % i == 0 and y % i == 0:
            dv.append(i)
    dv.sort()
    return dv[::-1] com_div dv = [] dv [] m = min(x, y) m min(x, y) min x y for i in range(1, m + 1):
        if x % i == 0 and y % i == 0:
            dv.append(i)
     i range(1, m + 1) range 1 m + 1 m 1 if x % i == 0 and y % i == 0:
            dv.append(i)
     x % i == 0 and y % i == 0 x % i == 0 x % i x i 0 y % i == 0 y % i y i 0 dv.append(i) dv.append dv append i dv.sort() dv.sort dv sort return dv[::-1] dv[::-1] dv ::-1 -1 x x y y 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 print(com_div(a, b)[k - 1]) print com_div(a, b)[k - 1] (a, b) com_div a b k - 1 k 1 def com_div(x, y):
    dv = []
    m = min(x, y)
    for i in range(1, m + 1):
        if x % i == 0 and y % i == 0:
            dv.append(i)
    dv.sort()
    return dv[::-1] def com_div(x, y):
    dv = []
    m = min(x, y)
    for i in range(1, m + 1):
        if x % i == 0 and y % i == 0:
            dv.append(i)
    dv.sort()
    return dv[::-1] com_div b, k = list(map(int, input().split())) list(map(int, input().split())) b 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
def com_div(x, y):
    dv = []
    m = min(x, y)
    for i in range(1, m + 1):
        if x % i == 0 and y % i == 0:
            dv.append(i)
    dv.sort()
    return dv[::-1]


a, b, k = list(map(int, input().split()))
print(com_div(a, b)[k - 1])