402182: GYM100687 H Graduation Projects (B)
Memory Limit:64 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
H. Graduation Projects (B)time limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard output
The imbalance value of last year was too large. Therefore, Dr. Saqr asked you to implement a program that produces a teams formation with the minimum possible imbalance value.
InputThe first line of input contains an integer N (1 ≤ N ≤ 50) representing the number of teams.
The second line contains 2N space-separated integers; each representing the grade of one student.
OutputPrint the 2N integers, such that if every two consecutive students formed a team, the imbalance value would be the minimum possible.
If there is more than one possible solution, print any of them.
ExamplesInput2Output
23 36 28 8
8 36 23 28Input
3Output
26 48 16 24 9 8
8 48 9 26 16 24