WILLITST - Will it ever stop


When Bob was in library in University of Warsaw he saw on one of facades caption :"Will it ever stop?" and below some mysterious code:

while n > 1
  if n mod 2 = 0 then
    n:=n/2
  else
    n:=3*n+3

Help him finding it out !

Input

In first line one number n<=10^14.

Output

Print "TAK" if program will stop, otherwise print "NIE"

Example

Input:
4

Output:
TAK

hide comments
Suvrat Krishna Mishra: 2015-08-25 19:43:43

finally...use bitwise!!!

poojan : 2015-08-19 18:13:10

hardest problem on spoj! it took 1 month to solve! lolz...

Ravi Chandra: 2015-08-17 09:26:34

Easy one.AC in one go

ROHIT Kumar: 2015-08-04 21:19:26

easy one just try the to make output upto 17 numbers u will get it....
my 50th on spoj....
AC in one go

ani_991: 2015-06-23 17:23:26

wow.. that was easy :p AC in first attemp

chin: 2015-06-17 19:19:57

AC in first attempt !!!...:)

Dipti Singhal: 2015-06-16 22:37:36

Give heed that program doesn't have to scan number of test cases.

Gaurav Agarwal: 2015-06-16 22:24:53

getting WA on 16th test case :<

blackhorse21: 2015-06-06 14:07:32

i submitted a solution it seems correct but gives runtime error (NZEC) Can one check why?
https://ideone.com/tTP6BW

Aadil Shaharyar Ahmed: 2015-05-26 20:04:17

n:=n/2 what does this mean...... plz nyone explain term by term .....dont really know the use of colon ( ; )


Added by:Krzysztof Lewko
Date:2011-11-09
Time limit:0.906s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:AMPPZ 2011