#include <bits/stdc++.h>
# define endl            '\n'
# define clr(x,a)        memset(x,a,sizeof(x))
# define vi              vector<int>
# define all(a)          a.begin(), a.end()
# define deb(x)          cout<<#x<<"=="<<x<<endl;
# define pb              push_back
# define sc              scanf
# define pr              printf
# define tc              int testcase; cin>>testcase; while(testcase--)
# define rev(s)          reverse(s.begin(),s.end())
# define linija          cout<<"___________\n";
using namespace std;
typedef long long ll;
const int mxN=10005;
ll n, m, k;
ll f(ll x){
   return ((x+1)*x)/2;
}
int main(){
   tc{
      cin>>n>>m>>k;
      if( (n%k)*f(n/k+1) + (k-n%k)*f(n/k) <= m) cout<<"Tak\n";
      else cout<<"Nie\n";
   }

   return 0;
}