题目描述
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|
SAMPLE INPUT
swagatam
3
1 5
3 5
5 6
SAMPLE OUTPUT
No
Yes
No
样例输入
yrhnjgnodwjyigkwwqhihowlwxrdeiflhrljsstjkumdrmhgbvkcncxgewxkohnktckgyjuormgtrcshdaghgrmalmdcmlpasumufgmoshyumcaunflwaddhurwbalachexkqktdrtvjkcotoefpxelyxdnvxhywwjolafhfggwkflpcshrxvalbuhaopyhluhtsqrodxctibggedbejkxepxlkidbbraymfapfwfetgvmyknqjsebjqefiprhiqfnvvljwcjsocwpccqehlqgpqbdnkesjoyksayrhduqjcwgtdtknenppbatljubwjbltyrgsecnoqtqpgteakogikteqqwtknhvmnsnyrjduucfimrtakjsyftniivxcarqsqtbuvomrsokiiwlrbspipuddidxdlabjvkaddbsvbvmnhtbuyraotrodttihpphfjalkhifvxhkvjtupttxlecdqdcasqqjddeicfndyjisncesugurtghicvpyuyrnkkeatchksbxtngjbnwaakkfdsinigfhjnurhdxrixgfuoifbeulmhjomsldlsyaxhfwgyhjtbkbiroypxwntnebjpldsulcwiedbuvlexftqbteddhuntinxjscwvjlydrptxjyixisyhoobpvcqiqkhmcpekubjmpeimhtxansckwrnkuwdjnmsfyxxewbvgdkaeiqqxqukbldenpikievmrgjmowwcqkiajnygtrgyfbgpepsvgnlcdvbxfrlssuemfpfljwxhmgywmjnsblyoytkcnayfrcpndfunnxolnsasbpuhyrnhyoahiwwcerwdaxurkcumjxuoltsdemfvgjwofbpidoekgfblyqonacgbdbsdaikivwckwewpheboyqtshypedkwexiqavdrlgnfrocitqfbflkkxqgqkyxujhvhaiiomgowupqrjvvvxkhxjllmoupaeywlegknxjnnwbtslklkdsj
78
224 925
328 808
720 907
52 96
980 987
164 406
466 838
703 715
986 997
370 852
991 995
427 577
170 786
512 790
498 607
447 864
67 489
762 997
690 691
720 975
155 800
101 293
467 603
354 454
883 965
613 906
426 559
270 813
756 870
829 874
896 944
309 738
870 911
824 836
194 841
334 753
975 997
728 806
52 89
912 956
833 994
444 444
865 967
802 852
125 993
5 722
258 800
567 949
911 958
815 826
777 835
640 671
938 948
718 736
91 643
169 736
502 711
866 994
404 722
13 409
208 297
604 712
996 999
121 753
829 917
206 379
189 862
217 230
413 845
894 977
126 225
933 959
565 847
324 493
542 841
865 925
866 937
225 580
样例输出
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No