#include <bits/stdc++.h>
using namespace std;
const int inf1 = 1e9 + 9;
const long long inf2 = 1e16 + 9;
const long long mol = 1e9 + 7;
const int maxn = 2e5 + 9;
const long long maxx = 1e12 + 9;
int n, q, l, r;
string s;
vector<int> ar[26];
bool judge() {
  int cnt = 0;
  for (int i = 0; i < 26; i++)
    if (upper_bound(ar[i].begin(), ar[i].end(), r) -
        upper_bound(ar[i].begin(), ar[i].end(), l))
      cnt++;
  return cnt >= 3;
}
int main() {
  cin >> s;
  n = s.size();
  for (int i = 0; i < n; i++) ar[s[i] - 'a'].push_back(i);
  scanf("%d", &q);
  while (q--) {
    scanf("%d%d", &l, &r);
    l--, r--;
    if (l == r || s[l] != s[r] || judge())
      printf("YES\n");
    else
      printf("NO\n");
  }
}
