include[HTML_REMOVED]
using namespace std;
const int N=50010;
char words[N];
int s[26][N];
int q,a,b,c,d;
int main(){
scanf(“%s”,words+1);
for(int i=0;i<26;i){
for(int j=1;words[j];j){
if(words[j]-'a'==i)
s[i][j]=s[i][j-1]+1;
else
s[i][j]=s[i][j-1];
}
}
cin>>q;
while(q–){
cin>>a>>b>>c>>d;
bool same=true;
for(int i=0;i<26;i++){
if(s[i][b]-s[i][a-1]!=s[i][d]-s[i][c-1])
same=false;
}
if(same)cout<<”DA”<<endl;
else cout<<”NE”<<endl;
}
return 0;
}