#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int neg = (a + b) % 2, less_than_1 = b + c, greater_than_1 = a + d;
    string s = "Tidak Tidak";
    if (less_than_1 == 0) {
      if (neg) {
        s = "Ya Tidak " + s + "\n";
      } else {
        s = s + " Tidak Ya\n";
      }
    } else if (greater_than_1 == 0) {
      if (neg) {
        s = "Tidak Ya " + s + "\n";
      } else {
        s = s + " Ya Tidak\n";
      }
    } else {
      if (neg) {
        s = "Ya Ya " + s + "\n";
      } else {
        s = s + " Ya Ya\n";
      }
    }
    cout << s;
  }
  return 0;
}
