#include <bits/stdc++.h>
using namespace std;
int msb(long long x) {
  union {
    double a;
    int32_t b[2];
  };
  a = x;
  return (b[1] >> 20) - 1023;
}
void sol() {
  int n, x, y;
  vector<int> a(4), b(4);
  for (int i = (0); i < (4); i++) {
    cin >> a[i];
  }
  if ((a[0] + a[1]) & 1) {
    if (a[0] || a[3]) b[0]++;
    if (a[1] || a[2]) b[1]++;
  } else {
    if (a[2] || a[1]) b[2]++;
    if (a[3] || a[0]) b[3]++;
  }
  for (int i = (0); i < (4); i++) cout << (b[i] ? "Ya " : "Tidak ");
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) sol();
}
