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