#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int h;
    if ((a + b) % 2 == 0)
      h = 1;
    else
      h = 0;
    int A = 0, B = 0, C = 0, D = 0;
    if (b + c > 0) {
      if (h == 1)
        C = 1;
      else
        B = 1;
    }
    if (a + d > 0) {
      if (h == 1)
        D = 1;
      else
        A = 1;
    }
    if (A == 1) {
      cout << "Ya"
           << " ";
    } else {
      cout << "Tidak"
           << " ";
    }
    if (B == 1) {
      cout << "Ya"
           << " ";
    } else {
      cout << "Tidak"
           << " ";
    }
    if (C == 1) {
      cout << "Ya"
           << " ";
    } else {
      cout << "Tidak"
           << " ";
    }
    if (D == 1) {
      cout << "Ya"
           << " ";
    } else {
      cout << "Tidak"
           << " ";
    }
    cout << endl;
  }
  return 0;
}
