#include <bits/stdc++.h>
using namespace std;
const int mxN = 2e5 + 5;
void solve() {
  int a, b, c, d;
  string s = "Ya", t = "Tidak", space = " ";
  cin >> a >> b >> c >> d;
  if ((a + b) % 2) {
    if (a || d)
      cout << s << space;
    else
      cout << t << space;
    if (b || c)
      cout << s << space;
    else
      cout << t << space;
    cout << t << space << t;
  } else {
    cout << t << space << t << space;
    if (b || c)
      cout << s << space;
    else
      cout << t << space;
    if (a || d)
      cout << s << space;
    else
      cout << t;
  }
  cout << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  cin >> T;
  while (T--) {
    solve();
  }
}
