#include <iostream>
#include <string>
bool czyPalindrom(std::string zdanie)
{
for(int i = 0, j = zdanie.length() - 1; i < j; i++, j--)
{
while (i < j && zdanie[i] == ' ')
i++;
while (i < j && zdanie[j] == ' ')
j--;
if (zdanie[i] != zdanie[j])
return false;
}
return true;
}
int main()
{
std::string zdanie;
std::getline(std::cin, zdanie);
std::cout << (czyPalindrom(zdanie) ? "TAK" : "NIE") << std::endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgoKYm9vbCBjenlQYWxpbmRyb20oc3RkOjpzdHJpbmcgemRhbmllKQp7Cglmb3IoaW50IGkgPSAwLCBqID0gemRhbmllLmxlbmd0aCgpIC0gMTsgaSA8IGo7IGkrKywgai0tKQoJewoJCXdoaWxlIChpIDwgaiAmJiB6ZGFuaWVbaV0gPT0gJyAnKQoJCQlpKys7CgkJd2hpbGUgKGkgPCBqICYmIHpkYW5pZVtqXSA9PSAnICcpCgkJCWotLTsKCQlpZiAoemRhbmllW2ldICE9IHpkYW5pZVtqXSkKCQkJcmV0dXJuIGZhbHNlOwoJfQoJcmV0dXJuIHRydWU7Cn0KCmludCBtYWluKCkKewoJc3RkOjpzdHJpbmcgemRhbmllOwoJc3RkOjpnZXRsaW5lKHN0ZDo6Y2luLCB6ZGFuaWUpOwoJc3RkOjpjb3V0IDw8IChjenlQYWxpbmRyb20oemRhbmllKSA/ICJUQUsiIDogIk5JRSIpIDw8IHN0ZDo6ZW5kbDsKfQ==