adding dfs poc for solving chained-waiton