a,b,k=map(int, input().split())
count=0
for i in range(a,0,-1):
  if a%i==0 and b%i==0:
    count+=1
  if count==k:
    print(i)
    break a,b,k=map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b k count=0 count 0 for i in range(a,0,-1):
  if a%i==0 and b%i==0:
    count+=1
  if count==k:
    print(i)
    break i range(a,0,-1) range a 0 -1 if a%i==0 and b%i==0:
    count+=1
   a%i==0 and b%i==0 a%i==0 a%i a i 0 b%i==0 b%i b i 0 count+=1 count 1 if count==k:
    print(i)
    break count==k count k print(i) print i break b,k=map(int, input().split()) map(int, input().split()) b a,b,k=map(int, input().split()) map(int, input().split()) a count+=1 1 count k=map(int, input().split()) map(int, input().split()) k count=0 0 count
a,b,k=map(int, input().split())
count=0
for i in range(a,0,-1):
  if a%i==0 and b%i==0:
    count+=1
  if count==k:
    print(i)
    break