#include <bits/stdc++.h>
using namespace std;
using gg = long long;
constexpr gg MAX = 3e5 + 5;
constexpr gg mod = 1e9 + 7;
gg ni, mi, ti, ki, di;
gg v[4];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> ti;
  while (ti--) {
    cin >> v[0] >> v[1] >> v[2] >> v[3];
    gg s = (v[0] + v[1]) % 2;
    vector<bool> b(4), ans(4);
    for (gg i = 0; i < 4; ++i) {
      b[i] = v[i] > 0;
    }
    gg c = count(begin(b), end(b), true);
    if (c == 1) {
      gg t = find(begin(b), end(b), true) - begin(b);
      if ((s == 1 and t >= 2) or (s == 0 and t < 2)) {
        ans[3 - t] = true;
      } else {
        ans[t] = true;
      }
    } else if (c == 2 and b[0] and b[3]) {
      s == 1 ? ans[0] = true : ans[3] = true;
    } else if (c == 2 and b[1] and b[2]) {
      s == 1 ? ans[1] = true : ans[2] = true;
    } else {
      if (s == 1) {
        ans[0] = ans[1] = true;
      } else {
        ans[2] = ans[3] = true;
      }
    }
    for (gg i = 0; i < 4; ++i) {
      cout << (ans[i] ? "Ya" : "Tidak") << " ";
    }
    cout << "\n";
  }
  return 0;
}
