#公約数を求める
def cf(x1,x2):
    cf=[]
    for i in range(1,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

# 初期入力
import sys
input = sys.stdin.readline  #文字列では使わない
A,B,K = map(int, input().split())

#公約数
div =cf(A,B)


print(div[-K]) def cf(x1,x2):
    cf=[]
    for i in range(1,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

# 初期入力 cf cf=[] cf [] for i in range(1,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
     i range(1,min(x1,x2)+1) range 1 min(x1,x2)+1 min(x1,x2) min x1 x2 1 if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
     x1 % i == 0 and x2 % i == 0 x1 % i == 0 x1 % i x1 i 0 x2 % i == 0 x2 % i x2 i 0 cf.append(i) cf.append cf append i return cf cf x1 x1 x2 x2 import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline A,B,K = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B K div =cf(A,B) div cf(A,B) cf A B print(div[-K]) print div[-K] div -K K K = map(int, input().split()) map(int, input().split()) K input = sys.stdin.readline sys.stdin.readline input B,K = map(int, input().split()) map(int, input().split()) B A,B,K = map(int, input().split()) map(int, input().split()) A div =cf(A,B) cf(A,B) div def cf(x1,x2):
    cf=[]
    for i in range(1,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

# 初期入力 def cf(x1,x2):
    cf=[]
    for i in range(1,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

# 初期入力 cf
#公約数を求める
def cf(x1,x2):
    cf=[]
    for i in range(1,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

# 初期入力
import sys
input = sys.stdin.readline  #文字列では使わない
A,B,K = map(int, input().split())

#公約数
div =cf(A,B)


print(div[-K])