monk-and-match-making
Source: hackerearth
Difficulty: MEDIUM

Monk has magical powers, by which he can compare any part of the strings and figure out if they're equal. His magical powers are faster than a super computer even. So, to prove his worth, he's given a string and he has to answer multiple queries based on the string.

Every query will have four integers - L1, R1, L2, R2. The first two integers denoting String [ L1, R1 ] (including both L1 and R1) denoting the first substring, the next two integers denoting the second substring  String [ L2, R2 ] (including both L2 and R2).

For every query, you've to answer in Yes or No whether the two substrings are equal or not. Easy enough?

Input:
The first line contains a string, S.
Then, an integer Q denoting the number of queries in the next line.
Then, for every query, there will be 4 integers L1 R1 L2 R2,  denoting the substring S[L1 R1] and S[L2 R2].

Output:
For each query output "Yes" if the two substrings are same , else output "No".

Constraints:
1 ≤ |S| ≤ 10^5
1 ≤ Q ≤ 10^5
1 ≤ L1 ≤ R1 ≤ |S|
1 ≤ L2 ≤ R2 ≤ |S|
The string will contain only lowercase letters.

SAMPLE INPUT
monkandhismonkiness
4
1 1 3 3
1 4 11 14
3 3 6 6
4 5 14 17

SAMPLE OUTPUT
No
Yes
Yes
No

Explanation

For Query 1 , it denotes the substrings "m" and "n" which do not match
For Query 2 , it denotes the substrings "monk" and "monk" which do match
For Query 3 , it denotes the substrings "n" and "n" which do match
For Query 4 , it denotes the substrings "ka" and "ki" which do not match


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
s=str(input());
q=int(input());
while(q!=0):
	buff=str(input());
	[l1,r1,l2,r2]=buff.split();
	if(s[int(l1)-1:int(r1)]==s[int(l2)-1:int(r2)]):
		print("Yes");
	else:
		print("No");
	q-=1;



S = input()
_ = eval(input())

while _>0:
	_ -= 1
	res = False
	l1, r1, l2, r2 = list(map(int, input().split()))
	if (l1==l2 and r1==r2) or (r1-l1) == (r2-l2) and S[l1-1:r1] == S[l2-1:r2]:
		res = True
	print('Yes' if res else 'No')


S = input()
_ = eval(input())

while _>0:
	_ -= 1
	res = False
	l1, r1, l2, r2 = list(map(int, input().split()))
	if (r1-l1) == (r2-l2) and S[l1-1:r1] == S[l2-1:r2]:
		res = True
	print('Yes' if res else 'No')


s = input()
t = {}
for _ in range(int(input())):
	k = input()
	a, b, c, d = list(map(int, k.split()))
	a -= 1
	c -= 1
	if k not in t:
		if s[a:b] == s[c:d]:
			t[k] = "Yes"
		else:
			t[k] = "No"
	print(t[k])


s = input()
l = len(s)
assert(1 <= l and l <= 10**5)
q = int(input())
assert(1 <= q and q <= 10**5)
for i in range(q):
 	a1, a2, b1, b2 = list(map(int, input().split(" ")))
	 	assert(1 <= a1 and a1 <= 10**5)
	 	assert(1 <= a2 and a2 <= 10**5)
	 	assert(1 <= b1 and b1 <= 10**5)
	 	assert(1 <= b2 and b2 <= 10**5)
		x = s[a1-1:a2]
		y = s[b1-1:b2]
	 	if x == y:
	 		print("Yes")
		else:
	 		print("No")



s=input()
q=int(input())
for i in range(0,q):
	l1,r1,l2,r2=list(map(int,input().split(' ')))
	s1=s[l1-1:r1]
	s2=s[l2-1:r2]
	if(s1==s2):
		print("Yes")
	else:
		print("No")


s = input()
l = len(s)
assert(1 <= l and l <= 10**5)
q = int(input())
assert(1 <= q and q <= 10**5)
for i in range(q):
	a1, a2, b1, b2 = list(map(int, input().split(" ")))
	x = s[a1-1:a2]
	y = s[b1-1:b2]
	if x == y:
		print("Yes")
	else:
		print("No")



'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
S = input()
q = int(input())

for i in range(q):
	
	L1,R1,L2,R2 = list(map(int,input().split(" ")))
	
	len1 = R1-L1+1
	len2 = R2 -L2 +1
	
	sub1 = S[L1-1:R1]
	sub2 = S[L2-1:R2]
	if sub1 == sub2:
		print("Yes")
	else:
		print("No")




'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
s = input()
l = len(s)
q = int(input())
for i in range(q):
    	a1, a2, b1, b2 = list(map(int, input().split(" ")))
    	x = s[a1-1:a2]
    	y = s[b1-1:b2]
    	if x == y:
    		print("Yes")
    	else:
    		print("No")


Str=input();	Q=eval(input());
for _ in range(Q):
	L1,L2,R1,R2=list(map(int,input().split()));
	S1=Str[L1-1:L2];	S2=Str[R1-1:R2];
	if S1==S2:
		print("Yes");
	else:
		print("No")


s = input()
l = len(s)
assert(1 <= l and l <= 10**5)
q = int(input())
assert(1 <= q and q <= 10**5)
for i in range(q):
	a1, a2, b1, b2 = list(map(int, input().split(" ")))
	x = s[a1-1:a2]
	y = s[b1-1:b2]
	if x == y:
		print("Yes")
	else:
		print("No")



'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
s = input()
n = (int)(input())
for i in range(n):
	l1, r1, l2 ,r2 = list(map(int, input().split(" ")))
	x = s[l1-1:r1]
	y = s[l2-1:r2]
	if x == y :
		print("Yes")
	else:
		print("No")






'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'

s = input()
q = int(input())

for i in range(q):
	l1, r1, l2, r2 = list(map(int, input().split()))
	x = s[l1-1:r1]
	y = s[l2-1:r2]
	print("Yes" if x == y else "No")


s = input()
l = len(s)
assert(1 <= l and l <= 10**5)
q = int(input())
assert(1 <= q and q <= 10**5)
for i in range(q):
	a1, a2, b1, b2 = list(map(int, input().split(" ")))
	assert(1 <= a1 and a1 <= 10**5)
	assert(1 <= a2 and a2 <= 10**5)
	assert(1 <= b1 and b1 <= 10**5)
	assert(1 <= b2 and b2 <= 10**5)
	x = s[a1-1:a2]
	y = s[b1-1:b2]
	if x == y:
		print("Yes")
	else:
		print("No")



s = input()
n = len(s)
assert(1 <= n and n <= 10**5)
q = int(input())
assert(1 <= q and q <= 10**5)
for i in range(q):
	l1,r1,l2,r2=list(map(int, input().split()))
	assert(1 <= l1 and l1 <= 10**5)
	assert(1 <= r1 and r1 <= 10**5)
	assert(1 <= l2 and l2 <= 10**5)
	assert(1 <= r2 and r2 <= 10**5)
	x = s[l1-1:r1]
	y = s[l2-1:r2]
	if x == y:
		
		
		print("Yes")
	else:
		print("No")



import sys
s=input()
for x in range(eval(input())):
	l1,r1,l2,r2 = list(map(int,sys.stdin.readline().split()))
	#print l1,r1,l2,r2
	s1=s[l1-1:r1]
	s2=s[l2-1:r2]
	if(s1==s2):
		print('Yes')
	else:
		print('No')


s=input()
for _ in range(eval(input())):
	a,b,c,d=list(map(int,input().split()))
	a-=1
	b-=1
	c-=1
	d-=1
	#print s[a:b+1]
	#print s[c:d+1]
	if s[a:b+1]==s[c:d+1]:
		print("Yes")
	else:
		print("No")
		


S = input()
_ = eval(input())

while _>0:
	_ -= 1
	res = False
	l1, r1, l2, r2 = list(map(int, input().split()))
	if (l1==l2 and r1==r2) or ((r1-l1) == (r2-l2) and S[l1-1:r1] == S[l2-1:r2]):
		res = True
	print('Yes' if res else 'No')