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