#include <bits/stdc++.h>
using namespace std;
int a[5];
bool able[5];
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    for (int i = 1; i <= 4; i++) able[i] = true;
    bool flag = true;
    for (int i = 1; i <= 4; i++) scanf("%d", &a[i]);
    if ((a[1] + a[2]) % 2 == 1) flag = false;
    if (flag) {
      able[1] = able[2] = false;
      if (a[4] == 0 && a[1] == 0) able[4] = false;
      if (a[2] == 0 && a[3] == 0) able[3] = false;
    } else {
      able[3] = able[4] = false;
      if (a[4] == 0 && a[1] == 0) able[1] = false;
      if (a[2] == 0 && a[3] == 0) able[2] = false;
    }
    for (int i = 1; i <= 4; i++) {
      if (able[i])
        printf("Ya ");
      else
        printf("Tidak ");
    }
    puts("");
  }
  return 0;
}
