#include <bits/stdc++.h>
using namespace std;
const int iinf = INT_MAX;
const long long linf = 9223372036854775807LL;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tc;
  cin >> tc;
  while (tc--) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    vector<bool> ans(4, true);
    if ((a + b) % 2 == 0) {
      ans[0] = ans[1] = false;
    } else if ((a + b) % 2 == 1) {
      ans[2] = ans[3] = false;
    }
    if (b + c > 0 && a + d == 0) {
      ans[0] = ans[3] = false;
    } else if (b + c == 0 && a + d > 0) {
      ans[1] = ans[2] = false;
    }
    for (int i = 0; i < (4); i++)
      if (ans[i])
        cout << "Ya ";
      else
        cout << "Tidak ";
    cout << endl;
  }
  return 0;
}
