#include <bits/stdc++.h>
using namespace std;
void test_case(int a, int b, int c, int d) {
  int p = (a + b) % 2;
  int ans[4] = {0, 0, 0, 0};
  if (p) {
    if (b + c > 0) ans[1] = 1;
    if (a + d > 0) ans[0] = 1;
  } else {
    if (a + d > 0) ans[3] = 1;
    if (b + c > 0) ans[2] = 1;
  }
  for (int i = 0; i < 4; i++) {
    if (ans[i])
      cout << "Ya"
           << " ";
    else
      cout << "Tidak"
           << " ";
  }
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  int a, b, c, d;
  while (t--) {
    cin >> a >> b >> c >> d;
    test_case(a, b, c, d);
  }
}
