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.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map.Entry;


import java.util.Random;
import java.util.TreeSet;

public final class CF_616_D1_B
{


	static boolean verb=true;
	static void log(Object X){if (verb) System.err.println(X);}
	static void log(Object[] X){if (verb) {for (Object U:X) System.err.print(U+" ");System.err.println("");}}
	static void log(int[] X){if (verb) {for (int U:X) System.err.print(U+" ");System.err.println("");}}
	static void log(int[] X,int L){if (verb) {for (int i=0;i<L;i++) System.err.print(X[i]+" ");System.err.println("");}}
	static void log(long[] X){if (verb) {for (long U:X) System.err.print(U+" ");System.err.println("");}}

	static void logWln(Object X){if (verb) System.err.print(X);}
	static void info(Object o){	System.out.println(o);}
	static void output(Object o){outputWln(""+o+"\n");	}
	static void outputFlush(Object o){try {out.write(""+ o+"\n");out.flush();} catch (Exception e) {}}
	static void outputWln(Object o){try {out.write(""+ o);} catch (Exception e) {}}



	// Global vars
	static BufferedWriter out;
	static InputReader reader;



	static void test() {
		log("testing");

		Random r=new Random();
		int NTESTS=100000;
		int NMAX=10;
		int TCX=2;
		for (int t=0;t<NTESTS;t++) {
			int L=r.nextInt(NMAX)+1;
			char[] c=new char[L];
			for (int i=0;i<L;i++) {
				c[i]=(char)('a'+(r.nextInt(TCX)));
			}


			int[][] nb=new int[CX][L];
			for (int i=0;i<L;i++) {
				if (i>0)
					for (int u=0;u<CX;u++) {
						nb[u][i]=nb[u][i-1];
					}
				int u=c[i]-'a';
				nb[u][i]++;
			}
		
			String s=new String(c);

			for (int e=0;e<L;e++) {
				for (int f=e+1;f<L;f++) {
					String a=solveSubtil(nb,c,e,f);
					String b=solveBourrin(s,nb,e,f);
					if (a!=b) {
						log("Error");
						log(L);
						log(s);
						log((e+1)+" "+(f+1));
						log("wrong:"+a+" // correct:"+b);
						return;
					}
				}
			}
		}

	}


	static class Composite implements Comparable<Composite>{
		int v;
		int idx;

		public int compareTo(Composite X) {
			if (v!=X.v)
				return v-X.v;
			return idx-X.idx;
		}

		public Composite(int v, int idx) {
			this.v = v;
			this.idx = idx;
		}

		public String toString() {
			return ""+v;
		}

	}

	static int CX=26;

	static String solveSubtil(int[][] nb,char[] c,int l,int r) {
		int cnt=0;
		int max=0;
		for (int u=0;u<CX;u++) {
			int delta=nb[u][r];
			if (l>0)
				delta-=nb[u][l-1];
			if (delta>0) {
				cnt++;
				max=Math.max(max, delta);
			}
		}
		String ans=YES;
		if (r-l>0) {
			if (cnt==1)
				ans=NO;
			else {
				if (cnt==2) {

					if (c[l]==c[r])
						ans=NO;
				}
			}



		}
		return ans;
	}
	static ArrayList<ArrayList<Integer>> generatePermutations(ArrayList<Integer> items){

		ArrayList<ArrayList<Integer>> globalRes=new ArrayList<ArrayList<Integer>>();
		if (items.size()==0)
			return globalRes;

		if (items.size()>1) {
			for (Integer item:items){

				ArrayList<Integer> itemsTmp=new ArrayList<Integer>(items);
				itemsTmp.remove(item);
				ArrayList<ArrayList<Integer>> res=generatePermutations(itemsTmp);
				for (ArrayList<Integer> list:res){
					list.add(item);
				}
				globalRes.addAll(res);
			}
		}
		else {
			Integer item=items.get(0);
			ArrayList<Integer> list=new ArrayList<Integer>();
			list.add(item);
			globalRes.add(list);
		}

		return globalRes;
	}

	static String YES="Yes";
	static String NO="No";



	static String solveBourrin(String s,int[][] nb,int l,int r) {
		// try any permutation
		if (r==l)
			return YES;
		ArrayList<Integer> items=new ArrayList<Integer>();
		for (int i=l;i<=r;i++)
			items.add(s.charAt(i)-'a');
		//log("items:"+items);
		ArrayList<ArrayList<Integer>> world=generatePermutations(items);
		for (ArrayList<Integer> perm:world) {
			//log("trying:"+perm);
			int[] cnt=new int[CX];
			boolean ok=true;
			for (int i=0;i<r-l;i++) {
				int u=perm.get(i);
				cnt[u]++;
				boolean diff=false;
				for (int v=0;v<CX;v++) {
					int ref=nb[v][l+i];
					if (l>0)
						ref-=nb[v][l-1];
					if (cnt[v]!=ref)
						diff=true;
				}
				if (!diff) {
					//log("issue with this perm at pos:"+(i+1));
					ok=false;
					break;
				}
			}
			if (ok) {
				//log("found a perm that is ok");
				return YES;
			}

		}

		return NO;
	}


	static void process() throws Exception {

		//log("hello");

		out = new BufferedWriter(new OutputStreamWriter(System.out));
		reader = new InputReader(System.in);

		//test();
		
		String s=reader.readString();
		char[] c=s.toCharArray();
		int L=s.length();

		int[][] nb=new int[CX][L];
		for (int i=0;i<L;i++) {
			if (i>0)
				for (int u=0;u<CX;u++) {
					nb[u][i]=nb[u][i-1];
				}
			int u=c[i]-'a';
			nb[u][i]++;
		}

		int T=reader.readInt();
		for (int t=0;t<T;t++) {
			int l=reader.readInt()-1;
			int r=reader.readInt()-1;
			String ans=solveSubtil(nb,c,l,r);
			output(ans);
		}

		try {
			out.close();
		} catch (Exception Ex) {
		}

	}





	public static void main(String[] args) throws Exception {
		process();

	}

	static final class InputReader {
		private final InputStream stream;
		private final byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		private int read() throws IOException {
			if (curChar >= numChars) {
				curChar = 0;
				numChars = stream.read(buf);
				if (numChars <= 0) {
					return -1;
				}
			}
			return buf[curChar++];
		}

		public final String readString() throws IOException {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.append((char) c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public final String readString(int L) throws IOException {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder(L);
			do {
				res.append((char) c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public final int readInt() throws IOException {
			int c = read();
			boolean neg = false;
			while (isSpaceChar(c)) {
				c = read();
			}
			char d = (char) c;
			// log("d:"+d);
			if (d == '-') {
				neg = true;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			// log("res:"+res);
			if (neg)
				return -res;
			return res;

		}

		public final long readLong() throws IOException {
			int c = read();
			boolean neg = false;
			while (isSpaceChar(c)) {
				c = read();
			}
			char d = (char) c;
			// log("d:"+d);
			if (d == '-') {
				neg = true;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			// log("res:"+res);
			if (neg)
				return -res;
			return res;

		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
	}

}
/*

5
1 4 5 2 3

 */