#include <bits/stdc++.h>
using namespace std;
int main() {
  int i = 0, j = 0, cs = 0, in;
  unsigned long long T;
  cin >> T;
  while (T--) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    bool arr[4];
    memset(arr, false, sizeof(arr));
    if ((a + b) & 1) {
      if (a || d) arr[0] = true;
      if (b || c) arr[1] = true;
    } else {
      if (b || c) arr[2] = true;
      if (a || d) arr[3] = true;
    }
    for (int i = 0; i < 4; i++) {
      if (i) cout << " ";
      if (arr[i])
        cout << "Ya";
      else
        cout << "Tidak";
    }
    cout << "\n";
  }
  return 0;
}
