#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  while (n--) {
    int a, b, c, d;
    scanf("%d%d%d%d", &a, &b, &c, &d);
    if ((a + b) % 2 == 0) {
      printf("Tidak Tidak");
      if ((a != 0 || d != 0) && (b == 0 && c == 0)) printf(" Tidak Ya\n");
      if ((a == 0 && d == 0) && (b != 0 || c != 0)) printf(" Ya Tidak\n");
      if ((a == 0 && d == 0) && (b == 0 && c == 0)) printf(" Tidak Tidak\n");
      if ((a != 0 || d != 0) && (b != 0 || c != 0)) printf(" Ya Ya\n");
    } else {
      if ((a != 0 || d != 0) && (b == 0 && c == 0)) printf("Ya Tidak ");
      if ((a == 0 && d == 0) && (b != 0 || c != 0)) printf("Tidak Ya ");
      if ((a == 0 && d == 0) && (b == 0 && c == 0)) printf("Tidak Tidak ");
      if ((a != 0 || d != 0) && (b != 0 || c != 0)) printf("Ya Ya ");
      printf("Tidak Tidak\n");
    }
  }
}
