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