QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 512 MB مجموع النقاط: 100

#4984. Set Partition

الإحصائيات

Xiao B, Xiao Y, and Xiao Z are inseparable friends and also staunch communists.

One day, they received $n$ cakes, where the $i$-th cake has a weight of $a_i$. Cakes cannot be cut and must be given to one person as a whole; furthermore, no cake can be wasted, meaning every cake must be assigned to one of the three people.

They all possess a selfless spirit of dedication and therefore do not care if the total weight of cakes they receive is smaller than that of others. However, based on the principle that "ideology is above friendship," they must ensure that the sum of the weights of cakes received by any two people is strictly greater than that of the third person; otherwise, the two people who received the smallest total weight will unite to smash the old world to pieces.

Due to highly developed productivity, the number and weight of the cakes have far exceeded their mental calculation abilities. They have come to ask you, who possess computer skills, to provide a reasonable distribution scheme or determine that no such scheme exists.

Input

The input consists of two lines.

The first line contains a positive integer $n$.

The second line contains $n$ positive integers $a_1, a_2, \dots, a_n$.

Output

If no valid distribution scheme exists, output Internationale!.

If one exists, output a string of length $n$, where each character is one of B, Y, or Z, representing the owner of the $i$-th cake.

If there are multiple valid schemes, any one of them is acceptable.

Examples

Input 1

6
7 5 4 1 2 8

Output 1

ZYBZYB

Input 2

5
1 2 6 1 1

Output 2

Internationale!

Subtasks

This problem uses subtask evaluation. You must pass all test cases within a subtask to receive the corresponding points.

For all data, $3 \le n \le 2 \times 10^5$ and $1 \le a_i \le 10^9$.

Subtask 1 (10 points): Guaranteed $n=3$.

Subtask 2 (16 points): Guaranteed $n \le 16$.

Subtask 3 (16 points): Guaranteed $n \le 10^3$ and $a_i \le n$.

Subtask 4 (28 points): Guaranteed that a valid solution exists.

Subtask 5 (30 points): No special restrictions.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.