using System;

namespace Kvalifikacije_2_B_18._12._2021
{
    class Program
    {
        static void deli(int t, ref int[] a)
        {
            int r=1, br;
            br = 1;
            string[] s = Console.ReadLine().Split();
            int n = int.Parse(s[0]);
            int m = int.Parse(s[1]);
            int k = int.Parse(s[2]);

            if (m < k||n<k||m<n)
                r = 0;
            while (k > 1 && n > 1 && m > 1)
            {
                n--;
                if (m % 2 == 0)
                    m = m / 2;
                else
                    m = (m - 1) / 2;
                k--;
            }
            if (k > 1 && n == 1)
                r = 0;
            while (n > 0)
            {
                br++;
                n--;
            }
            m = m - br;
            if (m < 0)
                r = 0;
            a[t-1] = r;
            t--;            
            if (t != 0)
                deli(t,ref a);                 
        }
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            int br = t-1;
            int[] a = new int[t];
            deli(t, ref a);
            while (br!=-1)
            {
                if (a[br] == 1)
                    Console.WriteLine("Tak");
                else
                    Console.WriteLine("Nie");
                br--;
            }

            
        }
    }
}