Time limit: 1s
Memory limit: 256MB
Input:
Output:
Task
An array consisting of positive integers is beautiful if and only if there exists an array such that is a permutation of and the sequence of its prefix-XORs is strictly increasing. That is, where for each .
The bitwise XOR of two integers and is defined in the following way:
the -th bit of is if and only if exactly one among and has in the -th bit.
Given an array consisting of positive integers, you have to determine for each non-empty prefix of whether it is beautiful.
Input data
The first line contains the only integer . The second line contains integers, .
Output data
You should print lines. In the th line, you must write YES
if the th prefix is beautiful and NO
otherwise.
Constraints and clarifications
- .
- for each .
# | Points | Constraints |
---|---|---|
1 | 0 | Examples. |
2 | 10 | |
3 | 11 | for each |
4 | 35 | |
5 | 44 | No additional limitations. |
Example 1
stdin
5
3 1 4 1 5
stdout
YES
YES
YES
YES
NO
Explanation
In the first sample case:
- The st prefix is beautiful because a sequence consisting of a single element is, by definition, strictly increasing.
- For the nd prefix, the permutation is suitable as the sequence is strictly increasing.
- For the rd prefix, the permutation is suitable as the sequence is strictly increasing.
- For the th prefix, the permutation is suitable as the sequence is strictly increasing.
- It can be checked that the th prefix is not beautiful.
Example 2
stdin
5
3 3 5 8 19
stdout
YES
NO
NO
NO
YES