#include <bits/stdc++.h>
using namespace std;
void judge(int s) { printf("%s", s ? "Ya " : "Tidak "); }
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int f = 0, ff = 0, fff = 0, ffff = 0;
    int a[4] = {0};
    for (int i = 0; i < 4; i++) {
      scanf("%d", a + i);
    }
    int neg = a[0] + a[1];
    int pos = a[2] + a[3];
    int inf = a[0] + a[3];
    int zero = a[2] + a[1];
    if (neg + pos == 0) {
      ;
    } else if (neg % 2) {
      if (inf && zero == 0) {
        f = 1;
      } else if (zero && inf == 0) {
        ff = 1;
      } else {
        f = ff = 1;
      }
    } else {
      if (inf && zero == 0) {
        ffff = 1;
      } else if (zero && inf == 0) {
        fff = 1;
      } else {
        fff = ffff = 1;
      }
    }
    judge(f);
    judge(ff);
    judge(fff);
    judge(ffff);
    printf("\n");
  }
  return 0;
}
