Implemented dfs for 1837
1837, issue when no Isanbaev in input