#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
vector<int>G[1000001];
queue<int>Q;
bool odwiedzony[1000001];
int poprzednik[1000001];
int odl[1000001];
int ta[1000001];
int tb[1000001];
int a,b,n,m,k;
void wczytaj()
{
cin>>n>>m;
for(int i=1;i<=m;i++)
{
cin>>a>>b;
G[a].push_back(b);
G[b].push_back(a);
ta[i]=a;
tb[i]=b;
}
}
void BFS(int s)
{
Q.push(s);
odwiedzony[s]=true;
while(!Q.empty())
{
k=Q.front();
Q.pop();
for(vector<int>::iterator p=G[k].begin();p!=G[k].end();p++)
//int en=G[k].size()
//for(int i=1;i<=en;i++)
{
if(!odwiedzony[*p])
{
odwiedzony[*p]=true;
Q.push(*p);
poprzednik[*p]=k;
odl[*p]=odl[k]+1;
}
}
}
}
bool spr()
{
bool b;
b=true;
for(int i=1;i<=m;i++)
{
if((odl[ta[i]]+odl[tb[i]])%2==0)
{
b=false;
break;
}
}
return b;
}
int main()
{
wczytaj();
for(int i=1;i<=n;i++)
if(!odwiedzony[i])
BFS(i);
if(spr())
cout<<"TAK";
else
cout<<"NIE";
//wypisz();
//system("PAUSE");
return 0;
}
I2luY2x1ZGUgPGNzdGRpbz4KI2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8cXVldWU+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwp2ZWN0b3I8aW50PkdbMTAwMDAwMV07CnF1ZXVlPGludD5ROwpib29sIG9kd2llZHpvbnlbMTAwMDAwMV07CmludCBwb3ByemVkbmlrWzEwMDAwMDFdOwppbnQgb2RsWzEwMDAwMDFdOwppbnQgdGFbMTAwMDAwMV07CmludCB0YlsxMDAwMDAxXTsKaW50IGEsYixuLG0sazsKdm9pZCB3Y3p5dGFqKCkKewpjaW4+Pm4+Pm07CmZvcihpbnQgaT0xO2k8PW07aSsrKQp7CmNpbj4+YT4+YjsKR1thXS5wdXNoX2JhY2soYik7ICAgICAKR1tiXS5wdXNoX2JhY2soYSk7CnRhW2ldPWE7CnRiW2ldPWI7ICAgICAKfQp9CnZvaWQgQkZTKGludCBzKQp7ClEucHVzaChzKTsgICAgIApvZHdpZWR6b255W3NdPXRydWU7ICAgIAp3aGlsZSghUS5lbXB0eSgpKQp7Cms9US5mcm9udCgpOyAgICAgICAgICAgICAKUS5wb3AoKTsgICAgICAgICAgICAgCmZvcih2ZWN0b3I8aW50Pjo6aXRlcmF0b3IgcD1HW2tdLmJlZ2luKCk7cCE9R1trXS5lbmQoKTtwKyspCi8vaW50IGVuPUdba10uc2l6ZSgpCi8vZm9yKGludCBpPTE7aTw9ZW47aSsrKQp7CmlmKCFvZHdpZWR6b255WypwXSkKewpvZHdpZWR6b255WypwXT10cnVlOwpRLnB1c2goKnApOwpwb3ByemVkbmlrWypwXT1rOwpvZGxbKnBdPW9kbFtrXSsxOyAgICAgICAgICAgICAgICAKfSAgICAgICAgICAgICAgICAgICAgICAgCn0gICAgICAgICAgICAgICAgCn0gICAgICAKfQpib29sIHNwcigpCnsKYm9vbCBiOwpiPXRydWU7ICAgIApmb3IoaW50IGk9MTtpPD1tO2krKykKewppZigob2RsW3RhW2ldXStvZGxbdGJbaV1dKSUyPT0wKSAgICAgICAKewpiPWZhbHNlOwpicmVhazsgICAgICAgICAgICAgICAgICAgICAgICAKfSAgCn0KcmV0dXJuIGI7ICAgIAp9CmludCBtYWluKCkKewp3Y3p5dGFqKCk7CmZvcihpbnQgaT0xO2k8PW47aSsrKQppZighb2R3aWVkem9ueVtpXSkKICBCRlMoaSk7CmlmKHNwcigpKQpjb3V0PDwiVEFLIjsKZWxzZQpjb3V0PDwiTklFIjsKLy93eXBpc3ooKTsKLy9zeXN0ZW0oIlBBVVNFIik7CnJldHVybiAwOwp9