#!/bin/python3 import sys import queue def valid(x,y,n,visited): return x>=0 and x=0 and y