loop do
  x,y = gets.split.map(&:to_i)
  break if x == 0 and y == 0
  n = gets.to_i
  data = gets.split.map(&:to_i).each_slice(2).to_a

  d = [-2,2].product([-1,0,1]) + [-1,0,1].product([-2,2])
  nexts = [[x,y]]

  loop do
    sx,sy = data.shift
    if sx.nil? and sy.nil?
      puts "OK"
      break
    end
    nexts = d.map{|dx,dy| nexts.map{|x,y| [x+dx,y+dy]}}.flatten(1).uniq.select do |x,y|
      (0..9) === x and (0..9) === y and (x-sx).abs <= 1 and (y-sy).abs <= 1
    end
    if nexts == []
      puts "NA"
      break
    end
  end
end