Popping by tap, tried integrating ps1 (didnt work), modified BFS/DFS