1
+ #include < bits/stdc++.h>
2
+ using namespace std ;
3
+
4
+
5
+ typedef string STR;
6
+ typedef long long LL;
7
+ typedef unsigned long long ULL;
8
+ typedef long double LD;
9
+ typedef vector<int > VI;
10
+ typedef priority_queue<int > PQI;
11
+ typedef vector<LL> VLL;
12
+ typedef vector<ULL> VULL;
13
+ typedef vector<STR> VSTR;
14
+ typedef vector<char > VC;
15
+ typedef pair<int ,int > PII;
16
+ typedef pair<LL,LL> PLL;
17
+ typedef pair<STR,int > PSI;
18
+ typedef pair<int ,STR> PIS;
19
+ typedef map<int ,int > MII;
20
+ typedef map<LL,LL> MLL;
21
+ typedef map<STR,int > MSI;
22
+ typedef map<char ,int > MCI;
23
+ typedef map<int ,STR> MIS;
24
+ typedef set<STR> SS;
25
+ typedef set<int > SI;
26
+ typedef set<LL> SLL;
27
+
28
+
29
+
30
+ #define FF first
31
+ #define PB push_back
32
+ #define PF push_front
33
+ #define MP make_pair
34
+ #define all (a ) (a).begin(),(a).end()
35
+ #define dec (n ) cout<<fixed<<setprecision(n);
36
+ #define f (i,a,b ) for (i = a; i < b; i++)
37
+ #define fr (i,a,b ) for (i = a; i > b; i--)
38
+ #define rep (i,n ) for (i = 0 ; i < n; i++)
39
+ #define repr (i,n ) for (i = n - 1 ; i >= 0 ; i--)
40
+ #define fsort (a ) sort(a.begin(),a.end())
41
+ #define rsort (a ) sort(a.rbegin(),a.rend())
42
+ #define fast ios_base::sync_with_stdio (false ),cin.tie(0 ),cout.tie(0 );srand(time(NULL ))
43
+
44
+ const LL MOD = 1000000007 ;
45
+ const int INF = 0x3f3f3f3f ;
46
+ const LL LL_INF = 0x3f3f3f3f3f3f3f3f ;
47
+ const LD PI = acosl(-1 .0l );
48
+ const LL MAXN = numeric_limits<LL>::max();
49
+ const LL MINN = (1e9 +1 );
50
+
51
+ void solve ()
52
+ {
53
+ int n,m,i,j;
54
+ cin>>n>>m;
55
+ int A[n][m];
56
+ int x=0 ;
57
+ rep (i,n)
58
+ {
59
+ rep (j,m)
60
+ {
61
+ cin>>A[i][j];
62
+ }
63
+ x ^=A[i][0 ];
64
+ }
65
+
66
+ if (x!=0 )
67
+ { cout<<" TAK\n " ;
68
+ rep (i,n) cout<<" 1 " ;
69
+ }
70
+ else {
71
+ int flag=0 ;
72
+ rep (i,n)
73
+ {
74
+ f (j,1 ,m)
75
+ {
76
+ if (A[i][j]!=A[i][0 ])
77
+ {flag=1 ;break ;}
78
+ }
79
+ if (flag==1 )
80
+ break ;
81
+ }
82
+ if (flag==1 )
83
+ {
84
+ cout<<" TAK\n " ;
85
+ int k=0 ;
86
+ rep (k,n)
87
+ {
88
+ if (k==i)
89
+ cout<<j+1 <<" " ;
90
+ else
91
+ cout<<1 <<" " ;
92
+ }
93
+ }
94
+ else
95
+ cout<<" NIE\n " ;
96
+ }
97
+
98
+ }
99
+ int main ()
100
+ {
101
+ fast;
102
+ int t=1 ;
103
+ while (t)
104
+ {
105
+ t--;
106
+ solve ();
107
+ }
108
+ return 0 ;
109
+ }
0 commit comments