Programming Exam

For each query, decide whether two given substrings of S are anagrams, printing DA or NE.

Medium4Prefix sumHash mapStringNo attempts yetTime limit3sMemory limit128 MB

Problem

Leticija is preparing for a programming exam. She has solved many tasks, but one is still unsolved, so she is asking you for help.

You are given a word SS and QQ queries. Each query gives positive integers AA, BB, CC, DD. Let XX be the word made of the letters of SS from position AA to position BB, and let YY be the word made of the letters from position CC to position DD.

For each query, decide whether the letters of YY can be rearranged into XX.

Input

The first line contains the word SS, which consists of lowercase letters of the English alphabet and satisfies 1S500001 \le |S| \le 50000. Here S|S| is the number of characters in SS.

The second line contains the number of queries QQ (1Q50000)(1 \le Q \le 50000).

Each of the next QQ lines contains four integers AA, BB, CC, DD (1ABS, 1CDS)(1 \le A \le B \le |S|,\ 1 \le C \le D \le |S|).

Output

For each query, print the answer on its own line. Print DA if the letters of YY can be rearranged into XX, and NE if they cannot. DA and NE are Croatian for yes and no.

Note

In the third example, the first query has XX equal to vovo and YY equal to devo. The second query has XX equal to odev and YY equal to devo.