#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if ((a + b) % 2 == 0) {
      cout << "Tidak Tidak";
      if (b || c)
        cout << " Ya";
      else
        cout << " Tidak";
      if (a || d)
        cout << " Ya";
      else
        cout << " Tidak";
    } else {
      if (a || d)
        cout << "Ya";
      else
        cout << " Tidak";
      if (b || c)
        cout << " Ya";
      else
        cout << " Tidak";
      cout << " Tidak Tidak";
    }
    cout << "\n";
  }
  return 0;
}
