Problem: Let's call two strings and anagrams of each other if it is possible to rearrange symbols in the string to get a string, equal to .
Let's consider two strings and which are anagrams of each other. We say that is a reducible anagram of if there exists an integer and non-empty strings that satisfy the following conditions:
- If we write the strings in order, the resulting string will be equal to ;
- If we write the strings in order, the resulting string will be equal to ;
- For all integers between and inclusive, and are anagrams of each other.
If such strings don't exist, then is said to be an irreducible anagram of . Note that these notions are only defined when and are anagrams of each other.
For example, consider the string "gamegame". Then the string "megamage" is a reducible anagram of , we may choose for example "game", "gam", "e" and "mega", "mag", "e":
On the other hand, we can prove that "memegaga" is an irreducible anagram of .
You will be given a string and queries, represented by two integers (where is equal to the length of the string ). For each query, you should find if the substring of formed by characters from the -th to the -th has at least one irreducible anagram.
Input Format: The first line contains a string , consisting of lowercase English characters ().
The second line contains a single integer () — the number of queries.
Each of the following lines contain two integers and (), representing a query for the substring of formed by characters from the -th to the -th.
Output Format: For each query, print a single line containing "Yes" (without quotes) if the corresponding substring has at least one irreducible anagram, and a single line containing "No" (without quotes) otherwise.
Note: In the first sample, in the first and third queries, the substring is "a", which has itself as an irreducible anagram since two or more non-empty strings cannot be put together to obtain "a". On the other hand, in the second query, the substring is "aaa", which has no irreducible anagrams: its only anagram is itself, and we may choose "a", "aa", "a", "aa" to show that it is a reducible anagram.
In the second query of the second sample, the substring is "abb", which has, for example, "bba" as an irreducible anagram.