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