Chintu wants to take her girlfriend in a restaurant for dinner but getting entry in that restaurant is not that easy. Restaurant gives each of its visitor a String S and two integers i,j and allows them to enter in the restaurant only if the letter at index i is equal to the letter at index j. Since Chintu is there regular customer so instead of giving him a pair of integers they(restaurant's manager) gives him N pair of integers. You need to find whether Chintu will get the entry or not.
Input format: First line of the input contains a string S. Next line contains an integer N, the number of pair of integers given to Chintu. These pairs are given in order. Next N line contains 2 integers i and j.(1-based indexing)
Output format: Print "Yes" if Chintu is able to get entry else print "No".
Constraints: 1 <= |S| <= 1000
1 <= N <= 100
1 <= i <= j <= |S|