A,B,K=map(int,input().split())
A_yaku=[]
B_yaku=[]

for i in range(1,A+1):
    if A % i == 0:
        A_yaku.append(i)

for j in range(1,B+1):
    if B % j == 0:
        B_yaku.append(j)

A_B_and_set = set(A_yaku) & set(B_yaku)
A_B_and_list = list(A_B_and_set)

ans_list=sorted(A_B_and_list,reverse=True)

ans=ans_list[K-1]
print(ans) A,B,K=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B K A_yaku=[] A_yaku [] B_yaku=[] B_yaku [] for i in range(1,A+1):
    if A % i == 0:
        A_yaku.append(i) i range(1,A+1) range 1 A+1 A 1 if A % i == 0:
        A_yaku.append(i) A % i == 0 A % i A i 0 A_yaku.append(i) A_yaku.append A_yaku append i for j in range(1,B+1):
    if B % j == 0:
        B_yaku.append(j) j range(1,B+1) range 1 B+1 B 1 if B % j == 0:
        B_yaku.append(j) B % j == 0 B % j B j 0 B_yaku.append(j) B_yaku.append B_yaku append j A_B_and_set = set(A_yaku) & set(B_yaku) A_B_and_set set(A_yaku) & set(B_yaku) set(A_yaku) set A_yaku set(B_yaku) set B_yaku A_B_and_list = list(A_B_and_set) A_B_and_list list(A_B_and_set) list A_B_and_set ans_list=sorted(A_B_and_list,reverse=True) ans_list sorted(A_B_and_list,reverse=True) sorted A_B_and_list reverse=True reverse True ans=ans_list[K-1] ans ans_list[K-1] ans_list K-1 K 1 print(ans) print ans A,B,K=map(int,input().split()) map(int,input().split()) A ans_list=sorted(A_B_and_list,reverse=True) sorted(A_B_and_list,reverse=True) ans_list ans=ans_list[K-1] ans_list[K-1] ans K=map(int,input().split()) map(int,input().split()) K B,K=map(int,input().split()) map(int,input().split()) B A_B_and_set = set(A_yaku) & set(B_yaku) set(A_yaku) & set(B_yaku) A_B_and_set A_B_and_list = list(A_B_and_set) list(A_B_and_set) A_B_and_list A_yaku=[] [] A_yaku B_yaku=[] [] B_yaku
A,B,K=map(int,input().split())
A_yaku=[]
B_yaku=[]

for i in range(1,A+1):
    if A % i == 0:
        A_yaku.append(i)

for j in range(1,B+1):
    if B % j == 0:
        B_yaku.append(j)

A_B_and_set = set(A_yaku) & set(B_yaku)
A_B_and_list = list(A_B_and_set)

ans_list=sorted(A_B_and_list,reverse=True)

ans=ans_list[K-1]
print(ans)