样例1: 2 3 1 2 3 6 5 4 样例2: 3 3 1 4 8 7 5 2 3 9 6 样例3: 3 3 9 3 1 4 7 2 8 6 5
样例1: 2 2 样例2: impossible 样例3: 4 3