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.math.*;
import java.util.*;
import java.io.*;

public class Main {
	private StreamTokenizer st;
	public PrintWriter pw;
	public static final int modulo = 1000000009;

	public static class Rational extends Number {

		private long num;
		private long denom;

		// Construct Rational object from numerator and denominator.
		// @param num the numerator
		// @param denom the denomenator

		public float floatValue() {
			return (float) ((float) this.num / (float) this.denom);
		}

		public double doubleValue() {
			return (double) ((double) this.num / (double) this.denom);
		}

		public int intValue() {
			return (int) ((int) this.num / (int) this.denom);
		}

		public long longValue() {
			return (long) ((long) this.num / (long) this.denom);
		}

		// Print
		public void print() {
			System.out.print(this.toString());
		}

		// Println
		public void println() {
			System.out.println(this.toString());
		}

		public Rational(long num, long denom) {
			this.num = num;
			this.denom = denom;
		}

		// Construct Rational number by parsing string.
		// (Note: The parsing is *really* primitive and not at all
		// robust.)
		// @param r a string representation of a rational number
		public Rational(String r) {
			long num = 0;
			long denom = 1;
			long whole = 0;
			// Parse a string of form "[N ]num/denom"
			StringTokenizer st1 = new StringTokenizer(r);
			if (st1.countTokens() == 2) {
				try {
					whole = Long.parseLong(st1.nextToken());
				} catch (Exception e) {
					whole = 0;
				}
			}
			if (st1.countTokens() == 1) {
				// Next, try to find the slash separating the
				// numerator and denominator.
				StringTokenizer st2 = new StringTokenizer(st1.nextToken(), "/",
						false);
				if (st2.countTokens() != 2) {
					num = 0;
					denom = 1;
				} else {
					try {
						num = Long.parseLong(st2.nextToken());
					} catch (NumberFormatException s) {
						num = 0;
					}
					try {
						denom = Long.parseLong(st2.nextToken());
					} catch (NumberFormatException s) {
						denom = 1;
					}
				}
			}
			this.num = (whole * denom) + num;
			this.denom = denom;
			this.normalize();
		}

		// Normalize the rational number so that the negative sign
		// is stored in the numerator, rather than the denominator.
		private void normalize() {
			long num = this.num;
			long denom = this.denom;
			if (denom < 0) {
				if (num < 0) {
					this.num = -num;
					this.denom = -denom;
				} else {
					this.denom = -denom;
				}
			}
		}

		// Reduce numerator and demoninator by greatest common denominator.
		public void reduce() {
			this.normalize();
			long g = gcd(this.num, this.denom);
			this.num /= g;
			this.denom /= g;
		}

		// Return numerator of this Rational object.
		public long num() {
			return this.num;
		}

		// Return denomenator of this Rational object.
		public long denom() {
			return this.denom;
		}

		// Addition
		// @param num the numerator
		// @param denom the denominator
		public void add(long num, long denom) {
			this.num = (this.num * denom) + (num * this.denom);
			this.denom = this.denom * denom;
			this.normalize();
		}

		// @param r a rational number object
		public void add(Rational r) {
			this.num = (this.num * r.denom()) + (r.num() * this.denom);
			this.denom = this.denom * r.denom();
			this.normalize();
		}

		// Subtraction
		// @param num the numerator
		// @param denom the denominator
		public void sub(long num, long denom) {
			this.num = (this.num * denom) - (num * this.denom);
			this.denom = this.denom * denom;
			this.normalize();
		}

		// @param r a rational number object
		public void sub(Rational r) {
			this.num = (this.num * r.denom()) - (r.num() * this.denom);
			this.denom = this.denom * r.denom();
			this.normalize();
		}

		// Multiplication
		// @param num the numerator
		// @param denom the denominator
		public void mul(long num, long denom) {
			this.num = (this.num * num);
			this.denom = (this.denom * denom);
			this.normalize();
		}

		// @param r a rational number object
		public void mul(Rational r) {
			this.num = (this.num * r.num());
			this.denom = (this.denom * r.denom());
			this.normalize();
		}

		// Division
		// @param num the numerator
		// @param denom the denominator
		public void div(long num, long denom) {
			this.num = (this.num * denom);
			this.denom = (this.denom * num);
			this.normalize();
		}

		// @param r a rational number object
		public void div(Rational r) {
			this.num = (this.num * r.denom());
			this.denom = (this.denom * r.num());
			this.normalize();
		}

		@Override
		public boolean equals(Object ss) {
			Rational a = (Rational) ss;
			if ((a.num() * this.denom()) == (this.num() * a.denom())) {
				return true;
			}
			return false;
		}

		// Instance method to test for
		// equivalence with another object (overrides Object's method)
		// @param a an object

		// Return Greatest Common Denominator (GCD)
		// @param a first long integer
		// @param b second long integer
		public long gcd(long a, long b) {
			long g;
			if (b == 0) {
				return a;
			} else {
				g = gcd(b, (a % b));
				if (g < 0)
					return -g;
				else
					return g;
			}
		}

		public static Rational compAdd(Rational a, Rational b) {
			return new Rational(a.num() + b.num(), a.denom() + b.denom());
		}

		@Override
		public int hashCode() {
			Rational q = new Rational(this.num, this.denom);
			q.reduce();
			return ((int) q.num) * 37 + ((int) q.denom);
		}
	}

	void init(String in, String out) throws Exception {
		if (in.isEmpty())
			st = new StreamTokenizer(System.in);
		else
			st = new StreamTokenizer(new BufferedReader(new FileReader(in)));

		if (out.isEmpty())
			pw = new PrintWriter(System.out);
		else
			pw = new PrintWriter(new FileWriter(out));
	}

	private void close() {
		pw.close();
	}

	private int nI() throws Exception {
		st.nextToken();
		return (int) st.nval;
	}

	private double nD() throws Exception {
		st.nextToken();
		return (double) st.nval;
	}

	private String nS() throws Exception {
		st.nextToken();
		return st.sval;
	}

	private long nL() throws Exception {
		st.nextToken();

		return (long) st.nval;
	}

	public static void main(String[] sssssssssss) throws Exception {

		Main f = new Main();
		f.init("", "");
		
		String s = f.nS();
		int n = s.length();
		
		int m = f.nI();
		
		int l[] = new int[m];
		int r[] = new int[m];
		
		for (int i = 0 ; i < m; ++i)
		{
			l[i] = f.nI() - 1;
			r[i] = f.nI() - 1;
		}
		
		int x[] = new int[n];
		int y[] = new int[n];
		int z[] = new int[n];
		
		Arrays.fill(x, 0);
		Arrays.fill(y, 0);
		Arrays.fill(z, 0);
		
		if (s.charAt(0) == 'x')
			x[0] = 1;
		if (s.charAt(0) == 'y')
			y[0] = 1;
		if (s.charAt(0) == 'z')
			z[0] = 1;
		
		
		for (int i = 1 ; i < n; ++i)
		{
			x[i] = x[i-1];
			y[i] = y[i-1];
			z[i] = z[i-1];
			
			if (s.charAt(i) == 'x')
				++x[i];
			if (s.charAt(i) == 'y')
				++y[i];
			if (s.charAt(i) == 'z')
				++z[i];
		}
		
		for (int i = 0 ; i < m; ++i)
		{
			int left = l[i];
			int right = r[i];
			
			if (left == 0)
			{
				int countX = x[right];
				int countY = y[right];
				int countZ = z[right];
				
				if (right - left + 1 >=3)
				{
				int max = Math.max(Math.max(countX, countY), countZ);
				if (countX + 1 < max || countY + 1 < max || countZ +1 < max)
					System.out.println("NO");
				else
					System.out.println("YES");
				}
				else
					System.out.println("YES");
			}
			else
			{
				int countX = x[right] - x[left-1];
				int countY = y[right] - y[left-1];
				int countZ = z[right] - z[left-1];
				
				if (right - left + 1 >=3)
				{
				int max = Math.max(Math.max(countX, countY), countZ);
				if (countX + 1 < max || countY + 1 < max || countZ +1 < max)
					System.out.println("NO");
				else
					System.out.println("YES");
				}
				else
					System.out.println("YES");
			}
		}
		
		f.close();

	}

}