IMC Trading interview question

Doing BFS/DFS on a chess board, stack manipulations.