#include <bits/stdc++.h>
using namespace std;
const long long Mod = 1000000007LL;
const int N = 2e5 + 10;
const long long Inf = 2242545357980376863LL;
const long long Log = 30;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long a, b, c, d;
  for (int i = 0; i < n; i++) {
    cin >> a >> b >> c >> d;
    long long dg = (a + b) % 2;
    long long sm = (b + c) > 0;
    long long bg = (a + d) > 0;
    cout << (dg == 1 && bg == 1 ? "Ya" : "Tidak") << " ";
    cout << (dg == 1 && sm == 1 ? "Ya" : "Tidak") << " ";
    cout << (dg == 0 && sm == 1 ? "Ya" : "Tidak") << " ";
    cout << (dg == 0 && bg == 1 ? "Ya" : "Tidak") << "\n";
  }
  return 0;
}
