deterministic case 1 failed: expected "1\n1\n3\n2\n0\n3" got "2\n1\n4\n2\n0\n2" input: 6 1 -1 -1 2 -1 2 -1 2 -1 -1 -1 3 -1 -1 3 -1 3 -1 2 3 -1 5 -1 -1 -1 1 0 -1