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

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

hide comments
2015-06-16 22:24:53 Gaurav Agarwal
getting WA on 16th test case :<
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
2015-05-26 20:04:17 Aadil Shaharyar Ahmed
n:=n/2 what does this mean...... plz nyone explain term by term .....dont really know the use of colon ( ; )
2015-05-13 14:20:08 Kushagra Sinha
Sometimes ignorance is bliss. Knowing http://en.wikipedia.org/wiki/Collatz_conjecture made me think that the problem is more difficult than it is.
2015-05-06 13:52:10 Mayank
Same logic but wrong answer in Python and accepted in C..why??
2015-05-05 21:49:01 scyth3r
2 lines of code....PYTHON_/\_
2015-05-01 00:28:35 Deepak sharma
easy problem AC in first attempt............
2015-04-28 21:09:03 Arpan Mukherjee
When I submitted the code I was damn confident It's not the right logic,just let's see what happens. I was just playing.And It got me AC :D
Awesome problem
2015-04-26 07:41:56 Abhishek Naik
What does NIE and TAK represent? I know it doesn't matter, but still.
2015-04-05 13:22:04 ashoka
O(1) :D
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.