codeforces round 179, task D