Encoder - knight chess : why am i getting wrong answer ?

why getting wrong answer ? someone explain whats wrong with this code. (Encoder - Knight Chess)

for _ in range(int(input())):

    knight_pos=[]
    for _ in range(int(input())):
        knight_pos.append((map(int,input().split())));
    
    x,y=map(int,input().split())
    king_move=[(x,y-1),(x+1,y-1),(x+1,y),(x+1,y+1),(x,y+1),(x-1,y+1),(x-1,y),(x-1,y-1)]

    attack_pos=[]
    for j in knight_pos:
        attack_pos.append((j[0]+1,j[1]-2))
        attack_pos.append((j[0]+2,j[1]-1))
        attack_pos.append((j[0]+2,j[1]+1))
        attack_pos.append((j[0]+1,j[1]+2))
        attack_pos.append((j[0]-1,j[1]+2))
        attack_pos.append((j[0]-2,j[1]+1))
        attack_pos.append((j[0]-2,j[1]-1))
        attack_pos.append((j[0]-1,j[1]-2))

    f=0
    for j in king_move:
        if j[0]<0 or j[1]<0 or j[0]>7 or j[1]>7:
            continue
        else:
            if j not in attack_pos:
                f=1
                break
    if(f==1):
        print("NO")
    else:
        print("YES")