#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  for (int asd = 0; asd < t; asd++) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if ((a + b) % 2 == 1 && (a > 0 || d > 0)) {
      cout << "Ya ";
    } else
      cout << "Tidak ";
    if ((a + b) % 2 == 1 && (b > 0 || c > 0)) {
      cout << "Ya ";
    } else
      cout << "Tidak ";
    if ((a + b) % 2 == 0 && (c > 0 || b > 0)) {
      cout << "Ya ";
    } else
      cout << "Tidak ";
    if ((a + b) % 2 == 0 && (d > 0 || a > 0)) {
      cout << "Ya ";
    } else
      cout << "Tidak ";
    cout << endl;
  }
  return 0;
}
