#C3251. Manager-Employee Hierarchy
Manager-Employee Hierarchy
Manager-Employee Hierarchy
In this problem, you are given one or more test cases. For each test case, you will receive an integer (N) followed by (N) space-separated integers representing employee IDs. Your task is to determine the manager-employee relationships by first sorting the list in ascending order. The smallest employee ID (i.e. (a_1) if the sorted list is (a_1, a_2, \dots, a_N)) is considered the manager, and every other employee (a_i) for (i \ge 2) is assigned that manager. For each subordinate, you should output a line in the format employee_id manager_id
.
inputFormat
The input is given via standard input (stdin). The first line contains an integer (T) representing the number of test cases. Each test case consists of two lines. The first line of each test case contains an integer (N), the number of employees. The second line contains (N) space-separated integers, representing the employee IDs.
outputFormat
For each test case, output the manager-employee relationships in multiple lines. For each test case, after sorting the employee IDs in ascending order, the smallest ID is regarded as the manager, and for every other employee output a line in the format employee_id manager_id
. All results from all test cases should be printed in the order of the test cases.## sample
1
5
4 1 7 3 2
2 1
3 1
4 1
7 1
</p>