1. 


/**
* Angewandte Mathematik, SS09, IFB 2C
* ACM Problem #10324 - Zeros and Ones
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=15&problem=1265&mosmsg=Submission+received+with+ID+7130218
*
* @author Andre Wolfram
* @author Christoph Miesel
* @author Robert Seilbeck
* @version 1.0, 05/15/2009
*
* Status : Accepted
* Runtime 1.172
*/



import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Iterator;

public class Main {

public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(
System.in));
String line;
int caseCounter = 1;
while ((line = reader.readLine()) != null) {
System.out.println("Case " + caseCounter + ":");
caseCounter++;
char currentChar = ' ';
//Zeile kompremieren sonst zu langsam
ArrayList<Integer> compressedString = new ArrayList<Integer>();
for (int i = 0; i < line.length(); i++) {
if (line.charAt(i) != currentChar) {
compressedString.add(i);
currentChar = line.charAt(i);
}

}
compressedString.add(line.length());
int inputLines = Integer.parseInt(reader.readLine());
for (int i = 0; i < inputLines; i++) {
String[] positions = reader.readLine().split(" ");
int pos1 = Integer.parseInt(positions[0]);
int pos2 = Integer.parseInt(positions[1]);
int minPos = Math.min(pos1, pos2);
int maxPos = Math.max(pos1, pos2);
Iterator<Integer> changePoints = compressedString.iterator();
//Auswertung der eingabe
if (minPos == maxPos) {
System.out.println("Yes");
} else {
while (changePoints.hasNext()) {
int position = changePoints.next();
if (minPos < position) {
if (maxPos < position) {
System.out.println("Yes");

}else{
System.out.println("No");
}
break;
}
}
}
}
}

}

}