Problem: You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:

1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, remove t_i and t_{i + 1} from t. Otherwise, let c be the next letter of t_i in the English alphabet, and replace t_i and t_{i + 1} together with c, reducing the length of t by 1.
3. Go back to step 1.



For example, when the robot is given the string `axxxxza`, it will be processed as follows: `axxxxza` → `ayxxza` → `ayyza` → `azza` → `aa` → `b`.

You are given a string s consisting of lowercase English letters. Answer Q queries. The i-th query is as follows:

* Assume that the robot is given a substring of s that runs from the l_i-th character and up to the r_i-th character (inclusive). Will the string be empty after processing?

Constraints

* 1 ≤ |s| ≤ 5 × 10^5
* s consists of lowercase English letters.
* 1 ≤ Q ≤ 10^5
* 1 ≤ l_i ≤ r_i ≤ |s|

Input

The input is given from Standard Input in the following format:


s
Q
l_1 r_1
l_2 r_2
:
l_Q r_Q


Output

Print Q lines. The i-th line should contain the answer to the i-th query: `Yes` or `No`.

Examples

Input

axxxxza
2
1 7
2 6


Output

No
Yes


Input

aabcdefghijklmnopqrstuvwxyz
1
1 27


Output

Yes


Input

yzyyyzyzyyyz
8
1 6
7 12
1 12
6 11
1 1
1 3
4 9
3 8


Output

Yes
Yes
Yes
Yes
No
No
No
No

Solution (in CPP):

Solution:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <climits>
#include <sstream>
#include <functional>
#include <complex>
#include <cassert>

using namespace std;

#define len(array)  (sizeof (array) / sizeof *(array))
#define rep(i, s, e) for(int i = (s);i < (e);i++)
#define Rep(i, e) for(int i = 0;i < (e);i++)
#define rrep(i, e, s) for(int i = (e);(s) <= i;i--)
#define Rrep(i, e) for(int i = e;0 <= i;i--)
#define maprep(i, e, t1, t2) for(map<t1, t2>::iterator i = e.begin(); i != e.end(); i++)
#define setrep(i, e, t) for(set<t>::iterator i = e.begin(); i != e.end(); i++)
#define vrange(v) v.begin(), v.end()
#define vrrange(v) v.rbegin(), v.rend()
#define vsort(v) sort(vrange(v))
#define vrsort(v) sort(vrrange(v))
#define arange(a) a, a + len(a)
#define asort(a) sort(arange(a))
#define arsort(a, t) sort(arange(a), greater<t>())
#define afill(a, v) fill(arange(a), v)
#define fabs(a) ((a) < 0? -(a) : (a))
#define pb push_back
#define fst(e) (e).first
#define snd(e) (e).second
#define rg(e, s, t) (s <= e && e < t)
#define PQDecl(name, tp) priority_queue< tp, vector<tp>, greater<tp> > name
#define dq(q) q.top();q.pop();
#define sz(v) ((int)(v).size())
#define lg(s) ((int)(s).length())
//#define X real()
//#define Y imag()
//typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<int> VI;
//typedef complex<double> p;
const int INF = (int)2e9;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-10;

#define MAX_N 500005
#define MAX_ALPHA 26
#define MAX_EXP 20

string s;
int q, qLeft, qRight;
int _next[MAX_N];
int _nextC[MAX_N][MAX_ALPHA];
int _next2Exp[MAX_N][MAX_EXP];

int next(int l);

// s[l]から文字列がcになる一番小さいr
int nextC(int l, int c) {
  if (l >= s.length()) {
    return INF;
  }

  int result = INF;
  int currentCode = s[l] - 'a';

  if (_nextC[l][c] == 0) {
    if (currentCode == c) {
      result = min(l, result);
    }
    else if (currentCode < c) {
        int tmp = nextC(l, c - 1);
        if (tmp < s.length()) {
          result = nextC(tmp + 1, c - 1);
        }
    }
    else {
      int tmp = next(l);
      if (tmp < s.length()) {
        result = nextC(tmp + 1, c);
      }
    }

    // printf("nextC(%d, %c) = %d\n", l, (char)(c + 'a'), result);
    _nextC[l][c] = result + 1;
  }

  return _nextC[l][c] - 1;
}

// s[l]から文字列が空になる一番小さいr
int next(int l) {
  if (l >= s.length()) {
    return INF;
  }

  int result = INF;
  if (_next[l] == 0) {
    int tmp = nextC(l, 'z' - 'a');
    if (tmp < s.length()) {
      result = nextC(tmp + 1, 'z' - 'a');
    }

    _next[l] = result + 1;
    // printf("next(%d) = %d\n", l, result);
  }

  return _next[l] - 1;
}

// next^{2^exp}(l)を求める
int next2Exp(int l, int exp) {
  if (l >= s.length()) {
    return INF;
  }
  // printf("next2Exp(%d, %d) invoked.\n", l, exp);

  int result = INF;
  if (_next2Exp[l][exp] == 0) {
    if (exp == 0) {
      result = next(l);
    }
    else {
      int tmp = next2Exp(l, exp - 1);
      if (tmp < s.length()) {
        result = next2Exp(tmp + 1, exp - 1);
      }
    }

    _next2Exp[l][exp] = result + 1;
  }
  // printf("2: next2Exp(%d, %d) = %d, memo = %d\n", l, exp, result, _next2Exp[l][exp]);


  return _next2Exp[l][exp] - 1;

}

// s[l..r]で文字列は空になるか
bool judge(int l, int r) {
  int index = l;
  for (int i = MAX_EXP - 1; i >= 0 ; i--){
    int tmp = next2Exp(index, i);

    if (tmp == r) {
      return true;
    }
    else if (tmp > r) {
      continue;
    }

    // printf("judge(%d, %d): loop %d -> next2Exp(%d, %d) = %d\n", l, r, i, index, i, tmp);

    index = tmp + 1;
  }

  return false;
}

void solve(){
  cin >> s;

  scanf("%d", &q);


  for (int i = 0; i < q; i++){
    scanf("%d%d", &qLeft, &qRight);

    cout << (judge(qLeft - 1, qRight - 1) ? "Yes" : "No") << endl;
  }
}

void doIt(){
  int t = 1;
  // scanf("%d", &t);
  while(t--){
    solve();
  }
}

void test() {
  s = "yzyyyzyzyyyz";

  nextC(7, 'y' - 'a');
  // for (int i = 0; i < s.length(); i++){
  //   printf("next2Exp(%d, 0) = %d\n", i, next2Exp(1, 0));
  // }
}

int main() {
  // test();
  doIt();
  return 0;
}