Problem: Let's call two strings s and t anagrams of each other if it is possible to rearrange symbols in the string s to get a string, equal to t.

Let's consider two strings s and t which are anagrams of each other. We say that t is a reducible anagram of s if there exists an integer k ≥ 2 and 2k non-empty strings s_1, t_1, s_2, t_2, ..., s_k, t_k that satisfy the following conditions:

  1. If we write the strings s_1, s_2, ..., s_k in order, the resulting string will be equal to s; 
  2. If we write the strings t_1, t_2, ..., t_k in order, the resulting string will be equal to t; 
  3. For all integers i between 1 and k inclusive, s_i and t_i are anagrams of each other. 



If such strings don't exist, then t is said to be an irreducible anagram of s. Note that these notions are only defined when s and t are anagrams of each other.

For example, consider the string s =  "gamegame". Then the string t =  "megamage" is a reducible anagram of s, we may choose for example s_1 =  "game", s_2 =  "gam", s_3 =  "e" and t_1 =  "mega", t_2 =  "mag", t_3 =  "e":

<image>

On the other hand, we can prove that t =  "memegaga" is an irreducible anagram of s.

You will be given a string s and q queries, represented by two integers 1 ≤ l ≤ r ≤ |s| (where |s| is equal to the length of the string s). For each query, you should find if the substring of s formed by characters from the l-th to the r-th has at least one irreducible anagram.

Input

The first line contains a string s, consisting of lowercase English characters (1 ≤ |s| ≤ 2 ⋅ 10^5).

The second line contains a single integer q (1 ≤ q ≤ 10^5) — the number of queries.

Each of the following q lines contain two integers l and r (1 ≤ l ≤ r ≤ |s|), representing a query for the substring of s formed by characters from the l-th to the r-th.

Output

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.

Examples

Input


aaaaa
3
1 1
2 4
5 5


Output


Yes
No
Yes


Input


aabbbbbbc
6
1 2
2 4
2 2
1 9
5 7
3 5


Output


No
Yes
Yes
Yes
No
No

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 s_1 =  "a", s_2 =  "aa", t_1 =  "a", t_2 =  "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.

Solution (in JAVA):

Solution:
import java.util.*; 
import java.io.*;

public class d {
  static int oo = Integer.MAX_VALUE-5;
  static boolean debug = false;
  public static void main(String[] args) {
    FS in = new FS(System.in); 

    char[] word = in.next().toCharArray();

    // Precomp to determine how many ranges of just 2 charcters there are
    TreeMap<Integer, Integer> tm = new TreeMap<>(); // left idx, right idx
    int c1 = (int)(word[0] - 'a');;  // Character Type 1
    int c2 = -1;  
    boolean allSameCharacter = true;
    int[] lastSeen = new int[26];
    int[] firstSeen = new int[26];
    int[] firstSeen2 = new int[26];
    Arrays.fill(lastSeen, -1);
    Arrays.fill(firstSeen, oo);
    Arrays.fill(firstSeen2, oo);
    lastSeen[c1] = 0;
    firstSeen[c1] = 0;
    firstSeen2[c1] = 0;
    int prevLet = (int)(word[0] - 'a');
    for(int i=1; i<word.length; i++) {
      int let = (int)(word[i] - 'a');
      int prev1 = lastSeen[c1];
      int prev2 = oo;
      lastSeen[let] = i;
      firstSeen[let] = Math.min(firstSeen[let], i);
      if(let != prevLet) {
        // update firstSeen[let]
        firstSeen2[let] = i;
      }
      if(c2 == -1) {
        if(let != c1) {
          c2 = let;
          allSameCharacter = false;
          prev2 = lastSeen[c2];
        }
      } else {
        if(debug) System.out.printf("i=%d c1=%d c2=%d first[c1]=%d first2[c1]=%d first[c2]=%d first2[c2]=%d\n", i, c1, c2, firstSeen[c1], firstSeen2[c1], firstSeen[c2], firstSeen2[c2]);
        prev2 = lastSeen[c2];
        
        // update the range if we now have 3 letter types
        if(let != c1 && let != c2) {
          if(firstSeen2[c1] < firstSeen2[c2]) {
            // Then we throw out c1
            int left = Math.min(firstSeen[c1], firstSeen[c2]);
            if(debug) System.out.printf("Putting (%d, %d) | 1\n", left, i-1);
            tm.put(left, i-1);
            c1 = let;
            firstSeen[c1] = i; 
            firstSeen[c2] = firstSeen2[c2];
            // if(debug) System.out.printf("Putting (%d, %d)\n", prev1, i-1);
            // tm.put(prev1, i-1);
          } else {
            // Throwing out c2
            int left = Math.min(firstSeen[c1], firstSeen[c2]);
            if(debug) System.out.printf("Putting (%d, %d) | 2\n", left, i-1);
            tm.put(left, i-1);
            c2 = let;
            firstSeen[c2] = i;
            firstSeen[c1] = firstSeen2[c1];
          }
        } else {
          // Same 2 letters. do nothing different
          

        }
      }
      prevLet = let;

    }

    if(c2 != -1) {
      int minFirst = Math.min(firstSeen2[c1], firstSeen[c2]);
      if(debug) System.out.printf("Putting (%d, %d)\n", minFirst, oo);
      tm.put(minFirst, oo);
    }


    int numQ = in.nextInt();
    for(int q=0; q<numQ; q++) {
      int l = in.nextInt()-1;
      int r = in.nextInt()-1;

      // Query the number of distinct characters
      // Maybe just determine how many ranges of just 2 characters there are.
      int numChars = 0;
      Integer lowerKey = tm.lowerKey(l+1);
      if(lowerKey == null) {
        numChars = 2;  // wait this hsould mean only 1 or 2 char type
        // unless there's only one character type.
        if(allSameCharacter) {
          numChars = 0;
        }
      } else {
        Integer rightEndPointForL = tm.get(lowerKey);
        if(debug) System.out.printf("Lowerkey = %d, rightEndPointForL=%d\n", lowerKey, rightEndPointForL);
        if(rightEndPointForL >= r) {
          // If we're within the range of a 2 character type
          numChars = 2;
        } else {
          numChars = 3;
        }
      }
      if(numChars > 2) {
        if(debug) System.out.println("More than 2 character types");
        System.out.println("Yes");
      } else if(numChars == 2 && word[l] != word[r]) {
        if(debug) System.out.println("2 char types, but endpoints dif");
        System.out.println("Yes");
      } else if(l == r) {
        if(debug) System.out.println("Length 1");
        System.out.println("Yes");
      } else {
        if(debug) {
          if(allSameCharacter) System.out.println("All same type char");
          if(numChars == 2) System.out.println("2 chars, same at endpoint");
        }
        System.out.println("No");
      }
      if(debug) System.out.println();

    }
  }

  static class FS {
    BufferedReader in ;
    StringTokenizer token;
    public FS(InputStream stream) {
      in = new BufferedReader(new InputStreamReader(stream));
    }
    public String next() {
      if(token == null || !token.hasMoreElements()) {
        try {
          token = new StringTokenizer(in.readLine()); 
        } catch (Exception e) {} 
        return next();
      }
      return token.nextToken();
    }
    public int nextInt() {
      return Integer.parseInt(next());
    }
  }
}
/* 

aaaaa
3
1 1
2 4
5 5

Yes
No
Yes


aabbbbbbc
6
1 2
2 4
2 2
1 9
5 7
3 5

No   // only 1 char type
Yes  // 2 char types, different at endpoints
Yes  // only len 1
Yes  // >2 types 
No   // same char type
No   // same char type


aabbccbbccdd
4
1 4
3 7
5 10
10 11


Yes  // 2 char types, diff endpoints
No   // 2 char types, same endpoints
No   // 2 char types, same endpoints
Yes  // 2 char types, diff endpoints



cabacabac
1
3 7


[0, 1] ca
[1, 3] aba
[3, 5] aca
[5, 7] aba
[7, oo] ac

3 7 bacab yes  // >3 char types



*/