#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t;
  cin >> t;
  while (t--) {
    long int a, b, c, d;
    cin >> a >> b >> c >> d;
    if ((a + b) % 2 == 1 && (a || d))
      cout << "Ya ";
    else
      cout << "Tidak ";
    if ((a + b) % 2 == 1 && (b || c))
      cout << "Ya ";
    else
      cout << "Tidak ";
    if ((a + b) % 2 == 0 && (c || b))
      cout << "Ya ";
    else
      cout << "Tidak ";
    if ((a + b) % 2 == 0 && (d || a))
      cout << "Ya" << endl;
    else
      cout << "Tidak" << endl;
  }
  return 0;
}
