Hey guys ! I kind of need your help to understand why I can't get past a test on this problem:
http://codeforces.me/contest/611/problem/H
It fails on test 3. I've extracted that test, ran it with my solution and to me it seems nothing is wrong. The checker reports "Graph is not connected", which is weird because if you check the output, it IS connected. Every node is connected to either node 1 or node 10, and nodes 1 and 10 are connected with each other.
My solution:
http://codeforces.me/contest/611/submission/15219155
Input of Test 3:
My solution's output to Test 3: