codeforces 1282 E. The Cake Is a Lie (dfs+构造)

NoSuchKey