## E - Dima and a Bad XOR

Student Dima from Kremland has a matrix aa of size n×mn×m filled with non-negative integers.

He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!

Formally, he wants to choose an integers sequence c1,c2,…,cnc1,c2,…,cn (1≤cj≤m1≤cj≤m) so that the inequality a1,c1⊕a2,c2⊕…⊕an,cn>0a1,c1⊕a2,c2⊕…⊕an,cn>0 holds, where ai,jai,j is the matrix element from the ii-th row and the jj-th column.

Here x⊕yx⊕y denotes the bitwise XOR operation of integers xx and yy.

Input

The first line contains two integers nn and mm (1≤n,m≤5001≤n,m≤500) — the number of rows and the number of columns in the matrix aa.

Each of the next nn lines contains mm integers: the jj-th integer in the ii-th line is the jj-th element of the ii-th row of the matrix aa, i.e. ai,jai,j (0≤ai,j≤10230≤ai,j≤1023).

Output

If there is no way to choose one integer from each row so that their bitwise exclusive OR is strictly greater than zero, print "NIE".

Otherwise print "TAK" in the first line, in the next line print nn integers c1,c2,…cnc1,c2,…cn (1≤cj≤m1≤cj≤m), so that the inequality a1,c1⊕a2,c2⊕…⊕an,cn>0a1,c1⊕a2,c2⊕…⊕an,cn>0 holds.

If there is more than one possible answer, you may output any.

Examples

Input

3 2 0 0 0 0 0 0

Output

NIE

Input

2 3 7 7 7 7 7 10

Output

TAK 1 3

Note

In the first example, all the numbers in the matrix are 00, so it is impossible to select one number in each row of the table so that their bitwise exclusive OR is strictly greater than zero.

In the second example, the selected numbers are 77 (the first number in the first line) and 1010 (the third number in the second line), 7⊕10=137⊕10=13, 1313 is more than 00, so the answer is found.

``````#include<iostream>
#include<cstdio>
using namespace std;

const int MAXN = 510;

int map[MAXN][MAXN] ={0};
int N,M;
//int out[MAXN] = 0;
int main(){

scanf("%d%d",&N,&M);

int ans = 0;
for(int i=1;i<=N;i++){
for(int j=1;j<=M;j++){
scanf("%d",&map[i][j]);
}
ans^=map[i];
}

if(ans>0){
printf("TAK\n");
for(int i=1;i<=N;i++){
if (i==1)printf("1");
else printf(" 1");
}

return 0;
}else{
for(int i=1;i<=N;i++){
for(int j=2;j<=M;j++){
int ii,ij;
if(map[i][j]!=map[i]){
ii = i;
ij = j;
printf("TAK\n");
for(int i=1;i<=N;i++){
if(i==ii)printf("%d",ij);
else printf("1");
if(i<N) printf(" ");
}

printf("\n");
return 0;
}
}
}
}

printf("NIE\n");

return 0;
}``````