I am using a BFS in order to search through the nodes from one path to another. What I am doing is going from grid[0][0] to grid[4][4] and this returns the path (LEFT,LEFT,L