1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
    long long int n, m, sum=0;
    scanf("%d %d", &n, &m);
    for(int i=0;i<n;++i)
    {
       int a,b,c;
       scanf("%d %d %d", &a, &b, &c);
       sum+=a+b+c;
    }
    if((sum%m)%2==0) printf("TAK");
    else printf("NIE");
    return 0;
}