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