#include <bits/stdc++.h>
using namespace std;
int t;
bool ans[50000][4];
int main() {
  cin >> t;
  for (int i = 0; i < t; i++) {
    int toys[4];
    for (int j = 0; j < 4; j++) {
      cin >> toys[j];
    }
    bool neg = (toys[0] + toys[1]) % 2 == 1;
    bool small = toys[1] >= 1 || toys[2] >= 1;
    bool big = toys[0] >= 1 || toys[3] >= 1;
    if (neg) {
      if (small) {
        ans[i][1] = true;
      }
      if (big) {
        ans[i][0] = true;
      }
    } else {
      if (small) {
        ans[i][2] = true;
      }
      if (big) {
        ans[i][3] = true;
      }
    }
  }
  for (int i = 0; i < t; i++) {
    for (int j = 0; j < 4; j++) {
      if (j != 0) {
        cout << ' ';
      }
      if (ans[i][j]) {
        cout << "Ya";
      } else {
        cout << "Tidak";
      }
    }
    cout << '\n';
  }
}
