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