A string is said to be periodic if there exists a string such that can be obtained by concatenating multiple (at least ) copies of .
In other words, is periodic if for some string , where is the string concatenation operation.
You are given a string of length and queries of the form .
For each query, determine whether the substring is a periodic string.
Input data
The first line contains an integer . The second line contains a string of length .
The third line contains an integer . The next lines contain the values , describing the queries.
Output data
For each query, print YES if the required substring is a periodic string or NO if it is not.
Constraints and clarifications
- .
- .
- The string consist of lowercase letters of the English alphabet.
- For tests worth points, .
- For tests worth more points, .
- For tests worth more points, .
Example
stdin
14
abacbaabcabccc
5
0 13
0 3
6 11
11 13
6 10
stdout
NO
NO
YES
YES
NO
Explanation
In the first query, it is asked if the whole string is periodic, so the answer is NO.
In the third query, the substring is periodic, as it can be obtained by concatenating twice.