a,b,k=map(int, input().split())

w_list=[]

num=min(a,b)+1

for i in range(1,num):
    if a%i==0 and b%i==0:
        w_list.append(i)
        
w_list.sort(reverse=True)
print(w_list[k-1]) a,b,k=map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b k w_list=[] w_list [] num=min(a,b)+1 num min(a,b)+1 min(a,b) min a b 1 for i in range(1,num):
    if a%i==0 and b%i==0:
        w_list.append(i)
         i range(1,num) range 1 num if a%i==0 and b%i==0:
        w_list.append(i)
         a%i==0 and b%i==0 a%i==0 a%i a i 0 b%i==0 b%i b i 0 w_list.append(i) w_list.append w_list append i w_list.sort(reverse=True) w_list.sort w_list sort reverse=True reverse True print(w_list[k-1]) print w_list[k-1] w_list k-1 k 1 a,b,k=map(int, input().split()) map(int, input().split()) a b,k=map(int, input().split()) map(int, input().split()) b k=map(int, input().split()) map(int, input().split()) k w_list=[] [] w_list num=min(a,b)+1 min(a,b)+1 num
a,b,k=map(int, input().split())

w_list=[]

num=min(a,b)+1

for i in range(1,num):
    if a%i==0 and b%i==0:
        w_list.append(i)
        
w_list.sort(reverse=True)
print(w_list[k-1])