Use DFS for checking walls