Sereja loves all sorts of algorithms. He has recently come up with a new algorithm, which receives a string as an input. Let's represent the input string of the algorithm as q = q1q2... qk. The algorithm consists of two steps:

  1. Find any continuous subsequence (substring) of three characters of string q, which doesn't equal to either string "zyx", "xzy", "yxz". If q doesn't contain any such subsequence, terminate the algorithm, otherwise go to step 2. 
  2. Rearrange the letters of the found subsequence randomly and go to step 1. 



Sereja thinks that the algorithm works correctly on string q if there is a non-zero probability that the algorithm will be terminated. But if the algorithm anyway will work for infinitely long on a string, then we consider the algorithm to work incorrectly on this string.

Sereja wants to test his algorithm. For that, he has string s = s1s2... sn, consisting of n characters. The boy conducts a series of m tests. As the i-th test, he sends substring slisli + 1... sri (1 ≤ li ≤ ri ≤ n) to the algorithm input. Unfortunately, the implementation of his algorithm works too long, so Sereja asked you to help. For each test (li, ri) determine if the algorithm works correctly on this test or not.

Input

The first line contains non-empty string s, its length (n) doesn't exceed 105. It is guaranteed that string s only contains characters: 'x', 'y', 'z'.

The second line contains integer m (1 ≤ m ≤ 105) — the number of tests. Next m lines contain the tests. The i-th line contains a pair of integers li, ri (1 ≤ li ≤ ri ≤ n).

Output

For each test, print "YES" (without the quotes) if the algorithm works correctly on the corresponding test and "NO" (without the quotes) otherwise.

Examples

Input

zyxxxxxxyyz
5
5 5
1 3
1 11
1 4
3 6


Output

YES
YES
NO
YES
NO

Note

In the first example, in test one and two the algorithm will always be terminated in one step. In the fourth test you can get string "xzyx" on which the algorithm will terminate. In all other tests the algorithm doesn't work correctly. 
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.ArrayList;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;
import java.util.PriorityQueue;
import java.util.HashMap;
import java.util.Stack;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.lang.reflect.Field;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.util.TreeSet;
import java.math.BigDecimal;
import java.util.Comparator;
import java.util.BitSet;
import java.util.Random;
import java.util.ArrayDeque;
import java.math.*;
public class Main{
   
    public static void main(String []args)throws IOException{
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        //BufferedReader x=new BufferedReader(new InputStreamReader(System.in));
       OutputWriter outt = new OutputWriter(outputStream);
       StringBuilder out=new StringBuilder();
       long start1=System.currentTimeMillis();
       
       /*int n=in.readInt();
       long mod=3046201;
       long arr[]=new long[n];
       long fact[]=new long[3000001];
       fact[0]=1;
       for(int i=1;i<3000001;i++){
            fact[i]=fact[i-1]*i;
            fact[i]=fact[i]%mod;
        }
       for(int i=0;i<n;i++) arr[i]=in.readInt();
       int q=in.readInt();
        Tree root=initialise(arr,0,n-1);
        while(q-->0){
            String qs=in.readString();
            int l=in.readInt()-1;
            int r=in.readInt();
            
            if(qs.equals("change")){
                long diff=r-arr[l];
                arr[l]=r;
                update(root,l,diff);
            }
            //else if(l==r-1) out.append("1\n");
            else{r=r-1;
                long sum=getSum(root,l,r);
               // System.out.println(sum);
                int m=r-l+1;
               
                long a2=sum%m;
                long a1=m-a2;
                long b1=sum/m;
                long b2=b1+1;
               long denom=fact[(int)(m-a1)];
               denom=denom*fact[(int)a1];
               denom=denom%mod;
               denom=denom*(pow(fact[(int)b1],a1));
               denom=denom%mod;
               denom=denom*(pow(fact[(int)b2],a2));
               denom=denom%mod;
                long num=fact[(int)m];
                num=num*fact[(int)sum];
                num=num%mod;
                long num2=pow(denom,mod-2);
                long ans=num*num2;
                ans=ans%mod;
                // System.out.println("mm  "+m+"  a1  "+a1+"  a2  "+a2+"  b1  "+b1+"  b2  "+b2);
                out.append(ans+"\n");
            }
        
        }
       // boolean coins[]=new boolean[n];
        
       // print(root);
        /*update_add(root,0,2);
        System.out.println("after update 0 2");
        print(root);
        System.out.println("query====" +count(root,0,4));
        System.out.println("query====" +count(root,0,1));
        update_add(root,0,1);
        System.out.println("after update 0 1");
        System.out.println("query====" +count(root,0,4));
        System.out.println("query====" +count(root,0,1));
        System.out.println("query====" +count(root,0,2));
        System.out.println("query====" +count(root,2,2));
        print(root);
        //for(int i=0;i)
   // outt.print(out);
    //outt.close();*/
        /*for(int i=0;i<q;i++){
        int type=in.readInt();
        int a=in.readInt();
        int b=in.readInt();
        if(type==0){flip(root,a,b);}
        else{int count=count(root,a,b);out.append(count+"\n");}
        }*/
        char []inp=in.readString().toCharArray();
        int N=inp.length;
        
            Tree root=initialise(inp,0,N-1);
            int m=in.readInt();
        while(m-->0){
            int l=in.readInt()-1;
            int r=in.readInt()-1;
            long sum[]=getSum(root,l,r);
            int mean=r-l+1;
            int mod=mean%3;
            if(mean<3) out.append("YES\n");
            
            else if(mod==0){
                if(sum[0]==sum[1]&&sum[1]==sum[2])
                    out.append("YES\n");
                else out.append("NO\n");}
            else if(mod==1){
                if(sum[0]==sum[1]&&sum[2]==sum[0]+1)
                    out.append("YES\n");
                else if(sum[1]==sum[2]&&sum[0]==sum[1]+1)
                    out.append("YES\n");
                else if(sum[0]==sum[2]&&sum[1]==sum[0]+1)
                    out.append("YES\n");
                else out.append("NO\n");
            }
            else if(mod==2){
               
                if(sum[0]==sum[1]&&sum[2]==sum[0]-1)
                out.append("YES\n");
               else if(sum[2]==sum[1]&&sum[0]==sum[1]-1)
                out.append("YES\n");
               else if(sum[0]==sum[2]&&sum[1]==sum[0]-1)
                out.append("YES\n");
               else out.append("NO\n");
            }
            
               
        }
        outt.print(out);
        outt.close();
  
      }
  
      static void print(Tree root){
        System.out.println("INTERVAL        "+ root.l+"         "+root.r);
         System.out.println("value"+ root.val);
        System.out.println("****************");
        
        if(root.left!=null) print(root.left);
        if(root.right!=null) print(root.right);
        }
      static Tree initialise(char arr[],int lef,int righ){
            if(lef==righ){
                long dd[]=new long[3];
                dd[decode(arr[lef])]++;
                return new Tree(lef,righ,null,null,dd,0);}
            else{
                int mid=(lef+righ)/2;
                Tree a=initialise(arr,lef,mid);
                Tree b=initialise(arr,mid+1,righ);
              long dd[]=new long[3];
              for(int i=0;i<3;i++)
                    dd[i]=a.val[i]+b.val[i];
               return new Tree(lef,righ,a,b,dd,0);
            }
        }
       static int decode(char a){
            if(a=='x') return 0;
            if(a=='y') return 1;
            return 2;
        }
        
        static long [] getSum(Tree root,int qs,int qe){
            if (qs <= root.l && qe >= root.r)
                return root.val;
                long dd[]=new long[3];
            if (root.r < qs || root.l > qe)
                return dd;
                long a[]=getSum(root.left,qs,qe);
                long b[]=getSum(root.right,qs,qe);
                for(int i=0;i<3;i++)
                    dd[i]=a[i]+b[i];
                    return dd;
        }
        /*static void update(Tree root,int i,int ch){
          if(i==root.l&&i==root.r) {root.val=ch;return;}
          int mid=(root.l+root.r)/2;
          if(i>mid) update(root.right,i,ch);
          else update(root.left,i,ch);
          if(root.height%2==0)
                root.val=root.left.val^root.right.val;
          else
                root.val=root.left.val|root.right.val;
                
        }*/
       /* static Tree clone(Tree root){
            return new Tree(root.l,root.r,root.left,root.right,root.val);
        }*/
        
   static long pow(long n, long exp){
  long prod = 1;
  
  while (exp > 0){
    if ((exp & 1) != 0)
       {prod *= n;prod=prod;}
    n*=n;n=n;
    exp >>= 1;
  }
  return prod;
}
 
static long modExp(long b, long e, long m)
{
long remainder;
long x = 1;
 
while (e != 0)
{
remainder = e % 2;
e= e/2;
 
if (remainder == 1)
x = (x * b) % m;
b= (b * b) % m; // New base equal b^2 % m
}
return x;
}
 
 
}
class Tree{
    Tree left;Tree right;
    int l;
    int r;
    long val[];
    int height;
    Tree(){l=0;r=0;val=new long[3];}
    Tree(int lef,int righ,Tree a, Tree b,long data[],int ht){val=new long[3];l=lef;r=righ;left=a;right=b;height=ht;
        for(int i=0;i<3;i++)
            val[i]=data[i];
    }
}
class IntegerUtils {
 
    public static long[] generateBinomialRow(int n, long module) {
        if (n < 0)
            return new long[0];
        long[] result = generateReverse(n + 1, module);
        result[0] = 1;
        for (int i = 1; i <= n; i++)
            result[i] = result[i - 1] * (n - i + 1) % module * result[i] % module;
        return result;
    }
 
    public static long[] generateReverse(int upTo, long module) {
        long[] result = new long[upTo];
        if (upTo > 1)
            result[1] = 1;
        for (int i = 2; i < upTo; i++)
            result[i] = (module - module / i * result[((int) (module % i))] % module) % module;
        return result;
    }
      public static long factorial(int n, long mod) {
        long result = 1;
        for (int i = 2; i <= n; i++)
            result = result * i % mod;
        return result % mod;
    }
 
    public static long binomialCoefficient(int n, int m, long mod) {
        if (m < 0 || m > n)
            return 0;
        if (2 * m > n)
            m = n - m;
        long result = 1;
        for (int i = n - m + 1; i <= n; i++)
            result = result * i % mod;
        return result * BigInteger.valueOf(factorial(m, mod)).modInverse(BigInteger.valueOf(mod)).longValue() % mod;
    }
 
    }
class d{
int val;int p;
d(){val=0;p=0;}
d(int v,int par){val=v;p=par;}
}

 
class road{
int begin;int end;
road(int i,int j){this.begin=i;this.end=j;}
road(){begin=0;end=0;}
} 
class song{
int band;int len;
song(int i,int j){this.band=i;this.len=j;}
song(){band=0;len=0;}
} 
 
class InputReader {
    
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;
 
    public InputReader(InputStream stream) {
        this.stream = stream;
    }
 
    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }
 
    public int readInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }
    public long readLong() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }
 
    public String readString() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuffer res = new StringBuffer();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }
 
    public boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }
 
    public String next() {
        return readString();
    }
 
    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }
}
 
class OutputWriter {
    private final PrintWriter writer;
 
    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }
 
    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }
 
    public void print(Object...objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }
 
    public void printLine(Object...objects) {
        print(objects);
        writer.println();
    }
 
    public void close() {
        writer.close();
    }}      