#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int arr[4];
    cin >> arr[0] >> arr[1] >> arr[2] >> arr[3];
    string A, B, C, D;
    string yes = "Ya";
    string no = "Tidak";
    if ((arr[0] + arr[1]) % 2 == 0) {
      A = no;
      B = no;
      if ((arr[0] > 0 || arr[3] > 0) && arr[1] == 0 && arr[2] == 0) {
        C = no;
        D = yes;
      } else if (arr[0] == 0 && (arr[1] > 0 || arr[2] > 0) && arr[3] == 0) {
        C = yes;
        D = no;
      } else {
        C = yes;
        D = yes;
      }
    } else {
      C = no;
      D = no;
      if ((arr[0] > 0 || arr[3] > 0) && arr[1] == 0 && arr[2] == 0) {
        A = yes;
        B = no;
      } else if (arr[0] == 0 && (arr[1] > 0 || arr[2] > 0) && arr[3] == 0) {
        A = no;
        B = yes;
      } else {
        A = yes;
        B = yes;
      }
    }
    cout << A << ' ' << B << ' ' << C << ' ' << D << '\n';
  }
  return 0;
}
