#include <bits/stdc++.h>
using namespace std;
int main() {
  long t, i, j;
  cin >> t;
  int a[t][4];
  for (i = 0; i < t; ++i) {
    long A, B, C, D;
    cin >> A >> B >> C >> D;
    for (j = 0; j < 4; ++j) a[i][j] = 1;
    if ((A + B) % 2) {
      a[i][2] = 0;
      a[i][3] = 0;
    } else {
      a[i][0] = 0;
      a[i][1] = 0;
    }
    if (A + D == 0) {
      a[i][0] = 0;
      a[i][3] = 0;
    }
    if (B + C == 0) {
      a[i][1] = 0;
      a[i][2] = 0;
    }
  }
  for (i = 0; i < t; ++i) {
    for (j = 0; j < 4; ++j) {
      if (a[i][j] == 0)
        cout << "Tidak ";
      else
        cout << "Ya ";
    }
    cout << endl;
  }
  return 0;
}
