N,M=map(int,input().split())
diniz=[]
uiniz=[]
brojac=0
niz=[]
for i in range(N):
    di,ui=map(int,input().split())
    diniz.append(di)
    uiniz.append(ui)
for j in range(M):
    brojac=0
    petlja=0
    l,r,x=map(int,input().split())
    for k in range(l-1,r,1):
        if diniz[k]<=x and x<=uiniz[k]:
            brojac+=1
    niz.append(brojac)
for o in range(len(niz)):
    print(niz[o])