static Point neighbour(Point p){
        Point q = null;
        for(int i= p.x-1;i<= p.x+1;i++)
                for(int j= p.y-1; j<=p.y+1;j++)
                        if(map[i][j] == 3 || map[i][j] == 8 || map[i][j] == 0 || map[i][j] == 7)
                                q= new Point(i,j);
        return q;
    }