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
2013-04-16 17:56:26 :-)
There is a good logic behind this problem
2013-04-15 16:17:49 ওয়াসী (Wasi)
Nice and easy!
I got couple of wrong answers for some stupid mistakes...
Check for 22 it worked for me.
2013-04-12 20:54:15 xxx
Use Unsigned long long for c/c++ users.....i have changed after 5 wa's...long long did'nt work ....Happy Coding !!
2013-03-22 14:31:43 Jagatheesvaran Palanisamy
just try this routine for n=0 to 100...u will find the soln
2013-02-20 11:59:38 Sivaraman Nagarajan
Nothing Big In It
2013-02-07 09:03:19 ankitsablok89
program culminated in a single line :)
2013-01-03 07:30:50 Mukund Kumar
my submission id : 8400204
can u plz tell me what z wrong wid my code??it z running till 17th test case
2012-12-28 02:52:47 Seshadri R
@simon: Operator precedence and order of evaluation
2012-12-17 10:08:56 Suyash Garg
shortest code ever written :)
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.