P6470 [COCI 2008/2009 #6] CUSKIJA
Description
Given a sequence $a$ of length $n$, reorder it so that in the new sequence, the sum of any two adjacent numbers is not divisible by $3$.
Input Format
The first line contains an integer $n$, the length of the sequence.
The second line contains $n$ integers. The $i$-th integer is the $i$-th element of the sequence, $a_i$.
Output Format
**This problem uses Special Judge**.
- If a solution exists, output a string `Yes` on the first line, and on the second line output $n$ integers, where the $i$-th integer is the $i$-th element of the new sequence.
- If no solution exists, output only a string `No` on one line.
Explanation/Hint
#### Constraints
For all testdata, it is guaranteed that $1 \leq n \leq 10^4$ and $1 \leq a_i \leq 10^6$.
#### [Notes]
**This problem is translated from [COCI2008-2009](https://hsin.hr/coci/archive/2008_2009/) [CONTEST #6](https://hsin.hr/coci/archive/2008_2009/contest6_tasks.pdf) *T4 CUSKIJA***. The translation and SPJ are provided by @[一扶苏一](https://www.luogu.com.cn/user/65363). For easier SPJ checking, the output format is slightly modified compared to the original problem.
Translated by ChatGPT 5