#include <bits/stdc++.h>
using namespace std;
void FAST() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
long long gcd(long long x, long long y) {
  if (x == 0) return y;
  return gcd(y % x, x);
}
long long powM(long long x, long long y, long long m) {
  long long ans = 1, r = 1;
  x %= m;
  while (r > 0 && r <= y) {
    if (r & y) {
      ans *= x;
      ans %= m;
    }
    r <<= 1;
    x *= x;
    x %= m;
  }
  return ans;
}
map<long long, long long> factorize(long long n) {
  map<long long, long long> ans;
  for (long long i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ans[i]++;
      n /= i;
    }
  }
  if (n > 1) {
    ans[n]++;
    n = 1;
  }
  return ans;
}
int main() {
  FAST();
  long long t;
  cin >> t;
  while (t--) {
    long long a[4];
    cin >> a[0] >> a[1] >> a[2] >> a[3];
    string s[4];
    for (int i = 0; i < 4; i++) {
      s[i] = "Tidak";
    }
    long long sum = a[0] + a[1] + a[2] + a[3];
    long long b = a[0] + a[1];
    for (int i = 0; i < 4; i++) {
      if (sum == 1) {
        if (a[i] == 1) s[i] = "Ya";
      }
    }
    if (sum != 1) {
      if (b % 2 == 0) {
        if (a[0] == 0 && a[3] == 0)
          s[2] = "Ya";
        else if (a[1] == 0 && a[2] == 0)
          s[3] = "Ya";
        else {
          s[2] = "Ya";
          s[3] = "Ya";
        }
      } else {
        if (a[0] == 0 && a[3] == 0)
          s[1] = "Ya";
        else if (a[1] == 0 && a[2] == 0)
          s[0] = "Ya";
        else {
          s[0] = "Ya";
          s[1] = "Ya";
        }
      }
    }
    for (int i = 0; i < 4; i++) {
      cout << s[i] << " ";
    }
    cout << '\n';
  }
  return 0;
}
