#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int MAXN = 1e5 + 10;
const int N = 102;
const long long mod = 1e9 + 7;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  return x * f;
}
int a[5];
int main() {
  ios::sync_with_stdio(false);
  int T;
  cin >> T;
  while (T--) {
    int A, B, C, D;
    memset(a, 0, sizeof(a));
    cin >> A >> B >> C >> D;
    C += B;
    D += A;
    if ((A + B) % 2 == 0) {
      a[1] = a[2] = 0;
      if (C > 0) a[3] = 1;
      if (D > 0) a[4] = 1;
    } else {
      a[3] = a[4] = 0;
      if (C > 0) a[2] = 1;
      if (D > 0) a[1] = 1;
    }
    for (int i = 1; i <= 4; ++i)
      if (a[i])
        cout << "Ya ";
      else
        cout << "Tidak ";
    cout << '\n';
  }
}
