# Printing Binary Array solution codechef

## Printing Binary Array solution codechef

Consider a binary array �=�1,�2,…,�� of length . Being a binary array means that every �� is either 0 or 1.
�����(�) is defined as the number of indices  (where 1≤�<�) such that ��≠��+1.

You are given a binary array �=�1,�2,…,�� of length . Print a binary array  of length  such that

• �≠�, and
• �����(�)=�����(�).

That is, print a binary array  which is not identical to , but has the same Score as that of .

It can be proven that such a  always exists.

## Printing Binary Array solution codechef

• The first line of input contains a single integer , denoting the number of test cases.
• Each test case consists of two lines of input:
• The first line of each test case contains a single integer  — the length of the binary array .
• The second line of each test case contains  space-separated integers �1,�2,…,�� representing the binary array .

### Output Format

For each test case, print  space-separated integers �1,�2,…,�� satisfying all the given conditions.

If there are multiple solutions, you can print any of them.

### Constraints

• 1≤�≤105
• 1≤�≤105
• 0≤��≤1
• The sum of  over all test cases won’t exceed 105.

### Sample 1:

Input

Output

2
1
0
3
1 1 0

1
0 1 1


### Explanation:

Testcase 1: The given array is �=�����(�)=0, since there are no indices such that ��≠��+1. Therefore, we need to output another array of length 1, whose Score is also 0. �= is the only such array, and we output it.

Testcase 2: The given array is �=[1,1,0]�����(�)=1, since �2≠�3. And it is the only such index. Therefore, we need to output another array of length 3, whose Score is also 1. �=[0,1,1] is one such array, and we output it. Note that there are other such arrays as well.