R1=list(range(-2,3))

R2=list(range(-1,2))

A1=[(x,y) for x in R1 for y in R1 if 3<x**2+y**2<6]

A2=[(x,y) for x in R2 for y in R2]

def fi(): return list(map(int,input().split(" ")))

def f(p,i):

  x,y=p

  A=[A1,A2][i>0]

  return set([(x+dx,y+dy) for dx,dy in A if 0<=x+dx<10 and 0<=y+dy<10])



while 1:

  xf,yf=fi()

  if yf==xf==0: break

  input()

  tmp=fi()

  PA=list(zip(tmp[0::2],tmp[1::2]))

  FA=set([(xf,yf)])

  for ps in PA:

    SA=f(ps,1)

    tmp=set([])

    for pf in FA: tmp=tmp|(SA&f(pf,0))

    FA=tmp

  print(["NA","OK"][len(FA)>0])
R1=list(range(-2,3))

R2=list(range(-1,2))

A1=[(x,y) for x in R1 for y in R1 if 3<x**2+y**2<6]

A2=[(x,y) for x in R2 for y in R2]

def fi(): return list(map(int,input().split(" ")))

def f(x,y,i):

  A=[A1,A2][i>0]

  return set([(x+dx,y+dy) for dx,dy in A if 0<=x+dx<10 and 0<=y+dy<10])



while 1:

  xf,yf=fi()

  if yf==xf==0: break

  input()

  tmp=fi()

  PA=list(zip(tmp[0::2],tmp[1::2]))

  FA=set([(xf,yf)])

  for xs,ys in PA:

    SA=f(xs,ys,1)

    tmp=set([])

    for xf,yf in FA: tmp=tmp|(SA&f(xf,yf,0))

    FA=tmp

  print(["NA","OK"][len(FA)>0])
R1 = list(range(-2, 3))
R2 = list(range(-1, 2))
A1 = [(x, y) for x in R1 for y in R1 if 3 < x**2 + y**2 < 6]
A2 = [(x, y) for x in R2 for y in R2]


def fi():
    return list(map(int, input().split(" ")))


def f(p, i):
    x, y = p
    A = [A1, A2][i > 0]
    return set(
        [(x + dx, y + dy) for dx, dy in A if 0 <= x + dx < 10 and 0 <= y + dy < 10]
    )


while 1:
    xf, yf = fi()
    if yf == xf == 0:
        break
    input()
    tmp = fi()
    PA = list(zip(tmp[0::2], tmp[1::2]))
    FA = set([(xf, yf)])
    for ps in PA:
        SA = f(ps, 1)
        tmp = set([])
        for pf in FA:
            tmp = tmp | (SA & f(pf, 0))
        FA = tmp
    print(["NA", "OK"][len(FA) > 0])

R1 = list(range(-2, 3))
R2 = list(range(-1, 2))
A1 = [(x, y) for x in R1 for y in R1 if 3 < x**2 + y**2 < 6]
A2 = [(x, y) for x in R2 for y in R2]


def fi():
    return list(map(int, input().split(" ")))


def f(x, y, i):
    A = [A1, A2][i > 0]
    return set(
        [(x + dx, y + dy) for dx, dy in A if 0 <= x + dx < 10 and 0 <= y + dy < 10]
    )


while 1:
    xf, yf = fi()
    if yf == xf == 0:
        break
    input()
    tmp = fi()
    PA = list(zip(tmp[0::2], tmp[1::2]))
    FA = set([(xf, yf)])
    for xs, ys in PA:
        SA = f(xs, ys, 1)
        tmp = set([])
        for xf, yf in FA:
            tmp = tmp | (SA & f(xf, yf, 0))
        FA = tmp
    print(["NA", "OK"][len(FA) > 0])

-def f(p, i): -    x, y = p +def f(x, y, i): -    for ps in PA: -        SA = f(ps, 1) +    for xs, ys in PA: +        SA = f(xs, ys, 1) -        for pf in FA: -            tmp = tmp | (SA & f(pf, 0)) +        for xf, yf in FA: +            tmp = tmp | (SA & f(xf, yf, 0))