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
nishabila: 2020-01-26 04:28:22

if n==1 then its NIE
got a wrong answer for this

abhijitburman: 2020-01-09 21:45:22

my first AC in one go. do not see comment box for this problem. just observe the problem and u will get the logic

mrdevesh_00: 2019-12-20 09:19:55

use bitwise

bohot_hard_123: 2019-12-12 05:24:41

haha this comment section is full of spoilers

Last edit: 2019-12-12 05:25:48
mrmajumder: 2019-11-14 17:16:53

haha vodox

aman_atg: 2019-09-11 20:06:30

ac in one go..

rahulsinghk: 2019-08-05 18:20:04

haha! just observe the pattern and use the same code to check.

shreyas_s: 2019-08-01 16:28:54

No array , floor or ceil required.
Just observe the pattern !!!

vamsi99: 2019-08-01 12:31:18

AC in one go!

vurise18: 2019-06-28 16:47:32

WA in 20th testcase


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