Codeforces Round #503 (by SIS, Div. 2) D. The hat

NoSuchKey