implemented CornersProblem with BFS