#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
template <typename T>
void debug(vector<T> x) {
  for (auto e : x) {
    cout << e << " ";
  }
  cout << "\n";
}
const long long N = 100005;
void solve() {
  vector<pair<long long, string>> v(4);
  for (long long i = 0; i < 4; i++) {
    cin >> v[i].first;
    v[i].second = "Tidak";
  }
  bool decimal = (v[1].first + v[2].first) > 0;
  if ((v[0].first + v[1].first) % 2 == 0) {
    if (decimal) {
      v[2].second = "Ya";
    }
    if (v[0].first > 0 || v[3].first > 0) {
      v[3].second = "Ya";
    }
  } else {
    if (decimal) {
      v[1].second = "Ya";
    }
    if (v[0].first > 0 || v[3].first > 0) {
      v[0].second = "Ya";
    }
  }
  for (long long i = 0; i < 4; i++) {
    cout << v[i].second << " ";
  }
  cout << "\n";
  return;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  cin >> t;
  for (long long i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
