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

for i in range(1,min(A,B)+1):
    if A%i==0 and B%i==0:
        l.append(i)
l=sorted(l)[::-1]
print(l[K-1]) A,B,K=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B K l=[] l [] for i in range(1,min(A,B)+1):
    if A%i==0 and B%i==0:
        l.append(i) i range(1,min(A,B)+1) range 1 min(A,B)+1 min(A,B) min A B 1 if A%i==0 and B%i==0:
        l.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 l.append(i) l.append l append i l=sorted(l)[::-1] l sorted(l)[::-1] (l) sorted l ::-1 -1 print(l[K-1]) print l[K-1] l K-1 K 1 A,B,K=map(int,input().split()) map(int,input().split()) A l=sorted(l)[::-1] sorted(l)[::-1] l K=map(int,input().split()) map(int,input().split()) K B,K=map(int,input().split()) map(int,input().split()) B l=[] [] l
A,B,K=map(int,input().split())
l=[]

for i in range(1,min(A,B)+1):
    if A%i==0 and B%i==0:
        l.append(i)
l=sorted(l)[::-1]
print(l[K-1])