a,b,k=map(int,input().split())
i=min(a,b)+1
while(k):
  i-=1
  if max(a%i,b%i)==0:
    k-=1
print(i) a,b,k=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b k i=min(a,b)+1 i min(a,b)+1 min(a,b) min a b 1 while(k):
  i-=1
  if max(a%i,b%i)==0:
    k-=1 k i-=1 i 1 if max(a%i,b%i)==0:
    k-=1 max(a%i,b%i)==0 max(a%i,b%i) max a%i a i b%i b i 0 k-=1 k 1 print(i) print i a,b,k=map(int,input().split()) map(int,input().split()) a i=min(a,b)+1 min(a,b)+1 i k-=1 1 k k=map(int,input().split()) map(int,input().split()) k b,k=map(int,input().split()) map(int,input().split()) b i-=1 1 i
a,b,k=map(int,input().split())
i=min(a,b)+1
while(k):
  i-=1
  if max(a%i,b%i)==0:
    k-=1
print(i)