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