dxy=zip([1,0,-1,0],[0,1,0,-1]) def rec(x,y,cnt): C[y][x]=str(cnt) for dx,dy in dxy: nx,ny=x+dx,y+dy if 0<=nx