#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long m, n;
  long long i, j;
  vector<long long> a(5);
  for (i = (1); i <= (4); i++) {
    cin >> a[i];
  }
  vector<bool> box(5, false);
  if ((a[1] + a[2]) & 1) {
    box[1] = true;
    box[2] = true;
  } else {
    box[3] = true;
    box[4] = true;
  }
  if (a[1] == 0 && a[4] == 0) {
    box[1] = false;
    box[4] = false;
  }
  if (a[2] == 0 && a[3] == 0) {
    box[2] = false;
    box[3] = false;
  }
  for (i = (1); i <= (4); i++) {
    box[i] ? cout << "Ya " : cout << "Tidak ";
  }
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long t;
  cin >> t;
  while (t--) solve();
  return 0;
}
