#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n;
  cin >> t;
  int a[4];
  for (int j = 1; j <= t; j++) {
    for (int i = 0; i < 4; i++) {
      cin >> a[i];
    }
    vector<string> p{"Tidak", "Tidak", "Tidak", "Tidak"};
    n = a[0] + a[1];
    if (n % 2 == 1) {
      if (a[0] != 0 || a[3] != 0) {
        p[0] = "Ya";
      }
      if (a[1] != 0 || a[2] != 0) {
        p[1] = "Ya";
      }
    } else {
      if (a[2] > 0 || a[1] > 0) {
        p[2] = "Ya";
      }
      if (a[3] > 0 || a[0] > 0) {
        p[3] = "Ya";
      }
    }
    for (int h = 0; h < 4; h++) {
      cout << p[h] << " ";
    }
    p.clear();
    cout << endl;
  }
}
