a,s,d=map(int,input().split())
from fractions import gcd
f=gcd(a,s)
for i in range(f,0,-1):
  if f%i:continue
  d-=1
  if d:continue
  print(i);exit() a,s,d=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split s d from fractions import gcd f=gcd(a,s) f gcd(a,s) gcd a s for i in range(f,0,-1):
  if f%i:continue
  d-=1
  if d:continue
  print(i);exit() i range(f,0,-1) range f 0 -1 if f%i:continue
   f%i f i d-=1 d 1 if d:continue
   d print(i) print i exit() exit d-=1 1 d f=gcd(a,s) gcd(a,s) f a,s,d=map(int,input().split()) map(int,input().split()) a d=map(int,input().split()) map(int,input().split()) d s,d=map(int,input().split()) map(int,input().split()) s
a,s,d=map(int,input().split())
from fractions import gcd
f=gcd(a,s)
for i in range(f,0,-1):
  if f%i:continue
  d-=1
  if d:continue
  print(i);exit()