Need Help in Atcoder Problem

Link to the Problem :- C - ThREE

Not able to understand what the probem is saying.
Anyone Please give some explaination(meaning of the problem with solution).

If the distance between any Vertex V_i and V_j is 3 ( distance here is referred as number of edges contained in the shortest path from V_i to V_j ), then the sum or product of P_i and P_j is a multiple of 3. So you have make such possible permutation such that above condition satisfies.

1 Like

I read the editorial of this problem but i understood only half of it.

Link to editorial (3rd Problem-ThREE)-https://img.atcoder.jp/hitachi2020/editorial.pdf

I will be Grateful if you can Explain the two cases given in the editorial

Can Anyone Help me with this?