a,b,k=map(int,input().split())

cnt=0
s=min(a,b)

for i in range(s,0,-1):
  if a%i==0 and b%i==0:
    cnt+=1
    #print(i)
    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 s=min(a,b) s min(a,b) min a b for i in range(s,0,-1):
  if a%i==0 and b%i==0:
    cnt+=1
    #print(i)
    if cnt==k:
      print(i)
      exit() i range(s,0,-1) range s 0 -1 if a%i==0 and b%i==0:
    cnt+=1
    #print(i)
    if cnt==k:
      print(i)
      exit() a%i==0 and b%i==0 a%i==0 a%i a i 0 b%i==0 b%i b i 0 cnt+=1 cnt 1 if cnt==k:
      print(i)
      exit() cnt==k cnt k print(i) print i exit() exit cnt=0 0 cnt b,k=map(int,input().split()) map(int,input().split()) b k=map(int,input().split()) map(int,input().split()) k s=min(a,b) min(a,b) s cnt+=1 1 cnt a,b,k=map(int,input().split()) map(int,input().split()) a
a,b,k=map(int,input().split())

cnt=0
s=min(a,b)

for i in range(s,0,-1):
  if a%i==0 and b%i==0:
    cnt+=1
    #print(i)
    if cnt==k:
      print(i)
      exit()
