#include <bits/stdc++.h>
#pragma GCC optimize("O3")
long long fact(int i) {
  if (i <= 1)
    return 1;
  else
    return i * fact(i - 1);
}
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int arr[4];
    for (int i = 0; i < 4; i++) {
      cin >> arr[i];
    }
    int minus = arr[0] + arr[1];
    string final[4];
    if (minus % 2 == 0) {
      final[0] = "Tidak";
      final[1] = "Tidak";
      if (arr[2] == 0) {
        if (arr[1] == 0) {
          final[2] = "Tidak";
        } else {
          final[2] = "Ya";
        }
      } else {
        final[2] = "Ya";
      }
      if (arr[3] == 0) {
        if (arr[0] == 0) {
          final[3] = "Tidak";
        } else {
          final[3] = "Ya";
        }
      } else {
        final[3] = "Ya";
      }
    } else {
      final[2] = "Tidak";
      final[3] = "Tidak";
      if (arr[0] == 0) {
        if (arr[3] == 0) {
          final[0] = "Tidak";
        } else {
          final[0] = "Ya";
        }
      } else {
        final[0] = "Ya";
      }
      if (arr[1] == 0) {
        if (arr[2] == 0) {
          final[1] = "Tidak";
        } else {
          final[1] = "Ya";
        }
      } else {
        final[1] = "Ya";
      }
    }
    for (int i = 0; i < 4; i++) {
      cout << final[i] << " ";
    }
    cout << endl;
  }
}
