#include<bits/stdc++.h> using namespace std; int main(){ int n,a,b; cin>>n; for(int i=1;i<=n;i++){ cin>>a>>b; if(a+b>=6) { if(a>b) cout<<"XDZ"; if(a==b) cout<<"DOGFALL"; if(a<b) cout<<"YY"; } else{ if(a<b) cout<<"XDZ"; if(a==b) cout<<"DOGFALL"; if(a>b) cout<<"YY"; } } return 0; }