private static void Main() { int remainingTestCases = FastIO.ReadNonNegativeInt(); while (remainingTestCases-- > 0) { int digitCount = FastIO.ReadNonNegativeInt(); int[] digits = new int[digitCount]; for (int d = 0; d < digitCount; ++d) { digits[d] = FastIO.ReadNonNegativeInt(); } if (JNEXT.Solve(digitCount, digits)) { for (int d = 0; d < digitCount; ++d) { FastIO.WriteDigit(digits[d]); } } else { FastIO.WriteNegativeOne(); } FastIO.WriteLine(); } FastIO.Flush(); }