Codeforces #506 E. Tree with Small Distances

NoSuchKey