using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Ekskurzija
{
    class Program
    {
        struct Test
        {
            public int n, m, k;

        }

        static void MozeLi(Test[] a)
        {
            string odg = "";
            for (int i = 0; i < a.Length; i++)
            {
                if (a[i].k == a[i].m && a[i].k == a[i].n || a[i].k==1)
                {
                    odg= "nie";
                }
                else
                {
                    odg= "tak";
                }
                Console.WriteLine(odg);
            }
        }


        static void Main(string[] args)
        {

            int t;
            t = int.Parse(Console.ReadLine());

            Test [] testovi = new Test[t];
            for (int i = 0; i < t; i++)
            {
                string[] s = Console.ReadLine().Split();
                testovi[i].n = int.Parse(s[0]);
                testovi[i].m = int.Parse(s[1]);
                testovi[i].k = int.Parse(s[2]);
            }

            MozeLi(testovi);

            Console.ReadKey();
        }
    }
}