Buggy python submission (verdict: Runtime Error):
def phyonkichi(p, n):
    yoko = 0
    tate = 1
    s = dic[n]
    p_lis = [(p[yoko]+a[yoko], p[tate]+a[tate]) for a in jump]
    s_lis = [(s[yoko]+a[yoko], s[tate]+a[tate]) for a in sprinkler]
    c_lis = []
    for v in list(set(p_lis) & set(s_lis)):
        if 0 <= v[yoko] <= 9 and 0 <= v[tate] <= 9:
            c_lis.append(v)
            
    if n == N:
        if c_lis:
            print 'OK'
            return True
        else:
            return
            
    for v in c_lis:
        if phyonkichi(v, n+1): return True
        
        
jump = [(2,-1),(2,0),(2,1),
        (-1,-2),(0,-2),(1,-2),
        (-2,1),(-2,0),(-2,-1),
        (-1,2),(0,2),(1,2)]

sprinkler = [(0,0),(1,0),(1,-1),
             (0,-1),(-1,-1),(-1,0),
             (-1,1),(0,1),(1,1)]

while True:
    w, h = map(int, raw_input().split(' '))
    if w == 0 and h == 0: break
    N = int(raw_input())
    lis = raw_input().split(' ')
    c_lis = [lis[i:i+2] for i in range(0, 20, 2)]
    dic = {}
    for i, c in enumerate(c_lis):
        dic[i+1] = (int(c[0]), int(c[1]))
    else:
        if not phyonkichi((w, h), 1):
            print 'NA'

Fixed submission:
def phyonkichi(p, n):
    yoko = 0
    tate = 1
    s = dic[n]
    p_lis = [(p[yoko]+a[yoko], p[tate]+a[tate]) for a in jump]
    s_lis = [(s[yoko]+a[yoko], s[tate]+a[tate]) for a in sprinkler]
    c_lis = []
    for v in list(set(p_lis) & set(s_lis)):
        if 0 <= v[yoko] <= 9 and 0 <= v[tate] <= 9:
            c_lis.append(v)
    if c_lis:
        if n == N:
            print 'OK'
            return True
        else:
            for v in c_lis:
                if phyonkichi(v, n+1): return True
    else:
        return
        
jump = [(2,-1),(2,0),(2,1),
        (-1,-2),(0,-2),(1,-2),
        (-2,1),(-2,0),(-2,-1),
        (-1,2),(0,2),(1,2)]

sprinkler = [(0,0),(1,0),(1,-1),
             (0,-1),(-1,-1),(-1,0),
             (-1,1),(0,1),(1,1)]

while True:
    w, h = map(int, raw_input().split(' '))
    if w == 0 and h == 0: break
    N = int(raw_input())
    lis = raw_input().split(' ')
    lis = [lis[i:i+2] for i in range(0, 2*N, 2)]
    dic = {}
    for i, c in enumerate(lis):
        dic[i+1] = (int(c[0]), int(c[1]))
    else:
        if not phyonkichi((w, h), 1):
            print 'NA'

Buggy python submission (verdict: Runtime Error):
def phyonkichi(p, n):
    yoko = 0
    tate = 1
    s = dic[n]
    p_lis = [(p[yoko]+a[yoko], p[tate]+a[tate]) for a in jump]
    s_lis = [(s[yoko]+a[yoko], s[tate]+a[tate]) for a in sprinkler]
    c_lis = []
    for v in list(set(p_lis) & set(s_lis)):
        if 0 <= v[yoko] <= 9 and 0 <= v[tate] <= 9:
            c_lis.append(v)
    else:
        if not c_lis:
            return
            
    if n == N:
        print 'YES'
        return True
            
    for v in c_lis:
        if phyonkichi(v, n+1): return True
        
        
jump = [(2,-1),(2,0),(2,1),
        (-1,-2),(0,-2),(1,-2),
        (-2,1),(-2,0),(-2,-1),
        (-1,2),(0,2),(1,2)]

sprinkler = [(0,0),(1,0),(1,-1),
             (0,-1),(-1,-1),(-1,0),
             (-1,1),(0,1),(1,1)]

while True:
    w, h = map(int, raw_input().split(' '))
    if w == 0 and h == 0: break
    N = int(raw_input())
    lis = raw_input().split(' ')
    c_lis = [lis[i:i+2] for i in range(0, 20, 2)]
    dic = {}
    for i, c in enumerate(c_lis):
        dic[i+1] = (int(c[0]), int(c[1]))
    else:
        if not phyonkichi((w, h), 1):
            print 'NA'

Fixed submission:
def phyonkichi(p, n):
    yoko = 0
    tate = 1
    s = dic[n]
    p_lis = [(p[yoko]+a[yoko], p[tate]+a[tate]) for a in jump]
    s_lis = [(s[yoko]+a[yoko], s[tate]+a[tate]) for a in sprinkler]
    c_lis = []
    for v in list(set(p_lis) & set(s_lis)):
        if 0 <= v[yoko] <= 9 and 0 <= v[tate] <= 9:
            c_lis.append(v)
    if c_lis:
        if n == N:
            print 'OK'
            return True
        else:
            for v in c_lis:
                if phyonkichi(v, n+1): return True
    else:
        return
        
jump = [(2,-1),(2,0),(2,1),
        (-1,-2),(0,-2),(1,-2),
        (-2,1),(-2,0),(-2,-1),
        (-1,2),(0,2),(1,2)]

sprinkler = [(0,0),(1,0),(1,-1),
             (0,-1),(-1,-1),(-1,0),
             (-1,1),(0,1),(1,1)]

while True:
    w, h = map(int, raw_input().split(' '))
    if w == 0 and h == 0: break
    N = int(raw_input())
    lis = raw_input().split(' ')
    lis = [lis[i:i+2] for i in range(0, 2*N, 2)]
    dic = {}
    for i, c in enumerate(lis):
        dic[i+1] = (int(c[0]), int(c[1]))
    else:
        if not phyonkichi((w, h), 1):
            print 'NA'

Buggy python submission (verdict: Runtime Error):
def phyonkichi(p, n):
    yoko = 0
    tate = 1
    if n[-1] == '0':
        n = 10
    else:
        n = int(n[-1])
    s = dic[n]
    p_lis = [(p[yoko]+a[yoko], p[tate]+a[tate]) for a in jump]
    s_lis = [(s[yoko]+a[yoko], s[tate]+a[tate]) for a in sprinkler]
    c_lis = []
    for v in list(set(p_lis) & set(s_lis)):
        if 0 <= v[yoko] <= 9 and 0 <= v[tate] <= 9:
            c_lis.append(v)
    else:
        if not c_lis:
            return
            
    for v in c_lis:
        if not v in res:
            res.append(v)
            if phyonkichi(v, str(n+1)): return True
            del res[-1]
        else:
            print v, res
            print 'OK'
            return True
        
        
jump = [(2,-1),(2,0),(2,1),
        (-1,-2),(0,-2),(1,-2),
        (-2,1),(-2,0),(-2,-1),
        (-1,2),(0,2),(1,2)]

sprinkler = [(0,0),(1,0),(1,-1),
             (0,-1),(-1,-1),(-1,0),
             (-1,1),(0,1),(1,1)]

while True:
    w, h = map(int, raw_input().split(' '))
    if w == 0 and h == 0: break
    N = int(raw_input())
    lis = raw_input().split(' ')
    c_lis = [lis[i:i+2] for i in range(0, 20, 2)]
    dic = {}
    res = []
    for i, c in enumerate(c_lis):
        dic[i+1] = (int(c[0]), int(c[1]))
    else:
        if not phyonkichi((w, h), '1'):
            print 'NA'

Fixed submission:
def phyonkichi(p, n):
    yoko = 0
    tate = 1
    s = dic[n]
    p_lis = [(p[yoko]+a[yoko], p[tate]+a[tate]) for a in jump]
    s_lis = [(s[yoko]+a[yoko], s[tate]+a[tate]) for a in sprinkler]
    c_lis = []
    for v in list(set(p_lis) & set(s_lis)):
        if 0 <= v[yoko] <= 9 and 0 <= v[tate] <= 9:
            c_lis.append(v)
    if c_lis:
        if n == N:
            print 'OK'
            return True
        else:
            for v in c_lis:
                if phyonkichi(v, n+1): return True
    else:
        return
        
jump = [(2,-1),(2,0),(2,1),
        (-1,-2),(0,-2),(1,-2),
        (-2,1),(-2,0),(-2,-1),
        (-1,2),(0,2),(1,2)]

sprinkler = [(0,0),(1,0),(1,-1),
             (0,-1),(-1,-1),(-1,0),
             (-1,1),(0,1),(1,1)]

while True:
    w, h = map(int, raw_input().split(' '))
    if w == 0 and h == 0: break
    N = int(raw_input())
    lis = raw_input().split(' ')
    lis = [lis[i:i+2] for i in range(0, 2*N, 2)]
    dic = {}
    for i, c in enumerate(lis):
        dic[i+1] = (int(c[0]), int(c[1]))
    else:
        if not phyonkichi((w, h), 1):
            print 'NA'