Codeforces Round #286 (Div. 2), problem: (B) Mr. Kitayuta's Colorful Graph 【二维并查集】

NoSuchKey