Battle
And so the battle erupted. You exchange spells, destroy planets, and tear apart the very fabric of reality. But so far, no one has managed to find a way to breach the opponent's defenses. Wizard Frusi taught you a spell capable of breaking through any defense, but the cautious Chmyaaax placed a limiter on you specifically designed to block that spell. Unfortunately, due to a lack of time, you did not manage to learn how to counter such a trick, but you remember that you need to know the key, which can be obtained as the answer to the following task:
Given an array of length and an array . For each find the biggest integer such that there exists an integer for which, in an array of length , where , all numbers from to (inclusive) appear among .
Here, means bitwise XOR operation.
Input
The first line contains two integers .
The second line contains integers — the elements of the array.
The third line contains integers .
Output
Output integers separated by a space — the solution to the problem for each for 1 to .
Examples
Note
In the second sample:
for we can choose , then our preffix wiil be: — is .
for we can choose , then our preffix wiil be: — is .
for we can choose , then our preffix wiil be: — is .
for we can choose , then our preffix wiil be: — is .
for we can choose , then our preffix wiil be: — is .
Scoring
( points): ;
( points): ;
( points): ;
( points): ;
( points): no additional constraints;