#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long tc;
  cin >> tc;
  for (long long ccc = 1; ccc <= tc; ccc++) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    string y = "Ya", n = "Tidak";
    string aa, bb, cc, dd;
    if ((a + b) % 2 == 0) {
      aa = bb = n;
      cc = dd = y;
      if (b == 0 && c == 0) cc = n;
      if (a == 0 && d == 0) dd = n;
    } else {
      aa = bb = y;
      cc = dd = n;
      if (b == 0 && c == 0) bb = n;
      if (a == 0 && d == 0) aa = n;
    }
    cout << aa << " " << bb << " " << cc << " " << dd << endl;
  }
  return 0;
}
