n,m=map(int, input().split())
vage=[]
for i in range(n):
    d,u=map(int, input().split())
    vage.append((d,u))
for i in range(m):
    l,r,x=map(int, input().split())
    br=0
    for j in range(l-1,r):
        if vage[j][0]<=x and x<=vage[j][1]:
            br+=1
    print(br)