As we all very well know, goats and sheep have been fighting for years about the fields they're grazing. After many fierce fights, the goat leader and the sheep leader decided to meet to try to find a peaceful solution to their problem. After many hours of discussion, they agreed that they will play a game for each field and that the winner will get to graze that field.
The game is played such that a total of animals (that can be goats or sheep) form a circle (the exact order of goats and sheep is an agreement between their leaders). After animal , the game is continued by animal , and after animal , the game is continued by animal . The animal starting the game can say any positive integer from the interval , but only if that number is not greater than . If the animal that started the game said the number , then the next animal can say a number in interval , but only if that number is not greater than . In other words, each animal can say a number that is greater by minimally , and maximally by than the number said by the animal before, but only if the new number is not greater than . If an animal must say number , its team (goats or sheep) loses.
If both the goats and the sheep are playing optimally, for each , determine who will win the field if the game is started by the animal.
Input Specification
The first line of input contains , and , the numbers from the task.
The following line contains numbers, if the animal is a sheep, and if it's a goat.
Output Specification
Output space-separated numbers. For each animal output if the sheep will win the field, and if the goats will win, if the animal is starting the game.
Scoring
In test cases worth a total of of points, it will hold .
Sample Input 1
2 9 2
0 1
Sample Output 1
0 1
Explanation for Sample Output 1
When a sheep is playing first, it can play like this: The sheep starts with number 2, after which the goat can say 3 or 4. In both cases, the sheep can say 5, after which the goat can say either 6 or 7. In both cases, the sheep can say 8, after which the goat doesn't have any other choice but 9 and thus losing the game and the field.
Sample Input 2
6 499 5
1 0 0 1 1 0
Sample Output 2
0 1 1 1 1 0
Sample Input 3
10 100 10
0 0 0 1 1 1 1 0 1 1
Sample Output 3
1 1 1 1 1 1 1 1 1 1
Comments