Codeforces Round #144 (Div. 2) A. Perfect Permutation

NoSuchKey