a, b, k=map(int, input().split())
cnt=0
x=max(a,b)
y=min(a,b)

for i in range(y, 0, -1):
  if x%i==0 and y%i==0:
    cnt+=1
  if cnt==k:
    print(i)
    exit() a, b, k=map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b k cnt=0 cnt 0 x=max(a,b) x max(a,b) max a b y=min(a,b) y min(a,b) min a b for i in range(y, 0, -1):
  if x%i==0 and y%i==0:
    cnt+=1
  if cnt==k:
    print(i)
    exit() i range(y, 0, -1) range y 0 -1 if x%i==0 and y%i==0:
    cnt+=1
   x%i==0 and y%i==0 x%i==0 x%i x i 0 y%i==0 y%i y i 0 cnt+=1 cnt 1 if cnt==k:
    print(i)
    exit() cnt==k cnt k print(i) print i exit() exit a, b, k=map(int, input().split()) map(int, input().split()) a cnt=0 0 cnt cnt+=1 1 cnt y=min(a,b) min(a,b) y k=map(int, input().split()) map(int, input().split()) k b, k=map(int, input().split()) map(int, input().split()) b x=max(a,b) max(a,b) x
a, b, k=map(int, input().split())
cnt=0
x=max(a,b)
y=min(a,b)

for i in range(y, 0, -1):
  if x%i==0 and y%i==0:
    cnt+=1
  if cnt==k:
    print(i)
    exit()