n,m=map ( int , input ().split())
l=[]
l1=[]
a=int
b=int
c=int
x=int
y=int
resenje=[0]*m
for i in range (n):
    x,y= list(map ( int , input ().split()))
    l.append(x)
    l1.append(y)
for i in range(m):
    a,b,c = map ( int , input ().split())
    for j in range (b-a+1):
        if ((c>=l[a+j-1]) and (c<=l1[a+j-1])):
            
            resenje[i]=resenje[i]+1
for i in range (m):
    print(resenje[i])