Codeforces Question(Div 3)

https://codeforces.com/contest/977/problem/D
i understood the question but when i saw the sample test case i am confused

particularly this test case
input
6
4 8 6 3 12 9
output
9 3 6 12 4 8