a,b,k = map(int,input().split())
#最大公約数を調べるためa,bのうつ値が最小値のものをsaiに代入
shou = min(a,b)
dai  = max(a,b)
min_list = []

for i in range(1,shou+1):
    if shou % i == 0:
        if dai % i == 0:
            min_list.append(i)

print(min_list[-k]) a,b,k = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b k shou = min(a,b) shou min(a,b) min a b dai  = max(a,b) dai max(a,b) max a b min_list = [] min_list [] for i in range(1,shou+1):
    if shou % i == 0:
        if dai % i == 0:
            min_list.append(i) i range(1,shou+1) range 1 shou+1 shou 1 if shou % i == 0:
        if dai % i == 0:
            min_list.append(i) shou % i == 0 shou % i shou i 0 if dai % i == 0:
            min_list.append(i) dai % i == 0 dai % i dai i 0 min_list.append(i) min_list.append min_list append i print(min_list[-k]) print min_list[-k] min_list -k k dai  = max(a,b) max(a,b) dai b,k = map(int,input().split()) map(int,input().split()) b a,b,k = map(int,input().split()) map(int,input().split()) a k = map(int,input().split()) map(int,input().split()) k min_list = [] [] min_list shou = min(a,b) min(a,b) shou
a,b,k = map(int,input().split())
#最大公約数を調べるためa,bのうつ値が最小値のものをsaiに代入
shou = min(a,b)
dai  = max(a,b)
min_list = []

for i in range(1,shou+1):
    if shou % i == 0:
        if dai % i == 0:
            min_list.append(i)

print(min_list[-k])