Codeforces 897C Nephren gives a riddle(DFS)

NoSuchKey