#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int nneg = a + b;
    int subz = b + c;
    int grez = a + d;
    if (grez && (nneg % 2))
      cout << "Ya ";
    else
      cout << "Tidak ";
    if (subz && (nneg % 2))
      cout << "Ya ";
    else
      cout << "Tidak ";
    if (subz && !(nneg % 2))
      cout << "Ya ";
    else
      cout << "Tidak ";
    if (grez && !(nneg % 2))
      cout << "Ya" << endl;
    else
      cout << "Tidak" << endl;
  }
  return 0;
}
