A,B,K=map(int,input().split())
S=set()
for i in range(1,min(A+1,B+1)):
    if A%i==0 and B%i==0:
        S.add(i)
print(sorted(S)[::-1][K-1]) A,B,K=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B K S=set() S set() set for i in range(1,min(A+1,B+1)):
    if A%i==0 and B%i==0:
        S.add(i) i range(1,min(A+1,B+1)) range 1 min(A+1,B+1) min A+1 A 1 B+1 B 1 if A%i==0 and B%i==0:
        S.add(i) A%i==0 and B%i==0 A%i==0 A%i A i 0 B%i==0 B%i B i 0 S.add(i) S.add S add i print(sorted(S)[::-1][K-1]) print sorted(S)[::-1][K-1] [::-1] (S) sorted S ::-1 -1 K-1 K 1 B,K=map(int,input().split()) map(int,input().split()) B S=set() set() S A,B,K=map(int,input().split()) map(int,input().split()) A K=map(int,input().split()) map(int,input().split()) K
A,B,K=map(int,input().split())
S=set()
for i in range(1,min(A+1,B+1)):
    if A%i==0 and B%i==0:
        S.add(i)
print(sorted(S)[::-1][K-1])