Little Leticija is preparing for a programming exam. Even though she has solved a lot of tasks, there's one still left unsolved, so she is asking you for help.
You are given the word and queries. In each query, you are given positive integers , , and .
Let's say that word consists of letters between positions and in word , and word from letters between positions and in word . For each query, you must answer if it is possible to somehow rearrange the letters in word and obtain word .
Input Specification
The first line of input contains the word . denotes the number of characters in word , which consists of lowercase letters of the English alphabet.
The second line of input contains the positive integer .
Each of the following lines contains four integers , , , ( and ) from the task.
Output Specification
For each query, output DA
(Croatian for yes) if it is possible, and NE
(Croatian for no) if it is not.
Scoring
In test cases worth of total points, it will hold: and .
Sample Input 1
kileanimal
2
2 2 7 7
1 4 6 7
Sample Output 1
DA
NE
Sample Input 2
abababba
2
3 5 1 3
1 2 7 8
Sample Output 2
DA
DA
Sample Input 3
vodevovode
2
5 8 3 6
2 5 3 6
Sample Output 3
NE
DA
Explanation for Sample Output 3
In the first query, vovo
, and devo
. In the second query, odev
, and devo
.
Comments