1 #include
2 #include<string.h>
3 #include
4 using namespace std;
5 int p , q , r , s , t ;
6 int K[2][2] = {0 , 0 , 0 , 1} , A[2][2] = {0 , 1 , 1 , 1} , N[2] = {1 , 0} , C[2][2] = {1 , 1 , 0 , 1} , E[2][2] = {1 , 0 , 0 , 1} ;
7 string st ;
8 int now ;
9 bool flag ;
10
11 int calc ()
12 {
13 now++ ;
14 switch (st[now])
15 {
16 case ‘K‘ : return K[calc()][calc()] ;
17 case ‘A‘ : return A[calc()][calc()] ;
18 case ‘N‘ : return N[calc()] ;
19 case ‘C‘ : return C[calc()][calc()] ;
20 case ‘E‘ : return E[calc()][calc()] ;
21 case ‘p‘ : return p ;
22 case ‘q‘ : return q ;
23 case ‘r‘ : return r ;
24 case ‘s‘ : return s ;
25 case ‘t‘ : return t ;
26 }
27 }
28 int main ()
29 {
30 // freopen ("a.txt" , "r" , stdin) ;
31 while (cin >> st && st != "0") {
32 flag = 0 ;
33 for (p = 0 ; p <2 && !flag ; p++)
34 for (q = 0 ; q <2 && !flag ; q++)
35 for (r = 0 ; r <2 && !flag ; r++)
36 for (s = 0 ; s <2 && !flag ; s++)
37 for (t = 0 ; t <2 && !flag ; t++) {
38 now = -1 ;
39 if ( !calc() )
40 flag = true ;
41 }
42 if (flag)
43 puts ("not") ;
44 else
45 puts ("tautology") ;
46 }
47 return 0 ;
48 }