#include <bits/stdc++.h>
using namespace std;
bool jud[5];
int num[5];
string str1 = "Ya";
string str2 = "Tidak";
void JUDGE() {
  const int fuhao = num[1] + num[2];
  if (num[1] != 0) {
    if (fuhao & 1) {
      if (num[2] != 0 || num[3] != 0)
        jud[1] = jud[2] = true;
      else
        jud[1] = true;
    } else {
      if (num[2] != 0 || num[3] != 0)
        jud[3] = jud[4] = true;
      else
        jud[4] = true;
    }
  } else {
    if (num[2] != 0) {
      if (fuhao & 1) {
        if (num[4] != 0) {
          jud[1] = jud[2] = true;
        } else {
          jud[2] = true;
        }
      } else {
        if (num[4] != 0) {
          jud[3] = jud[4] = true;
        } else {
          jud[3] = true;
        }
      }
    } else {
      if (num[4] != 0) {
        if (num[3] == 0) {
          jud[4] = true;
        } else {
          jud[3] = jud[4] = true;
        }
      } else {
        jud[3] = true;
      }
    }
  }
  for (int i = 1; i <= 4; i++) {
    if (jud[i]) {
      cout << str1 << " ";
    } else {
      cout << str2 << " ";
    }
  }
  memset(jud, 0, sizeof(jud));
  cout << endl;
}
int main() {
  int n;
  cin >> n;
  while (n--) {
    scanf("%d%d%d%d", num + 1, num + 2, num + 3, num + 4);
    JUDGE();
  }
}
