using System;
using System.Collections.Generic;

internal class Program
{
    class Vaga
    {
        private int d, u;

        public int D
        {
            get { return d; }
        }

        public int U
        {
            get { return u; }
        }

        public Vaga(int d, int u)
        {
            this.d = d;
            this.u = u;
        }
    }

    class Pitanje
    {
        private int l, r, x;

        public int L
        {
            get { return l; }
        }

        public int R
        {
            get { return r; }
        }

        public int X
        {
            get { return x; }
        }

        public Pitanje(int l, int r, int x)
        {
            this.l = l;
            this.r = r;
            this.x = x;
        }
    }

    static void Main(string[] args)
    {
        string[] str = Console.ReadLine().Split(" ");
        int n = int.Parse(str[0]);
        int m = int.Parse(str[1]);
        List<int> res = new List<int>();

        Vaga[] V = new Vaga[n];
        Pitanje[] P = new Pitanje[m];

        for (int i = 0; i < n; i++)
        {
            str = Console.ReadLine().Split(" ");
            V[i] = new Vaga(int.Parse(str[0]), int.Parse(str[1]));
        }

        for (int i = 0; i < m; i++)
        {
            str = Console.ReadLine().Split(" ");
            P[i] = new Pitanje(int.Parse(str[0]), int.Parse(str[1]), int.Parse(str[2]));
        }

        for (int i = 0; i < m; i++)
        {
            int k = 0;
            for (int j = P[i].L-1; j < P[i].R; j++)
            {
                if (P[i].X >= V[j].D && P[i].X <= V[j].U)
                    k++;
            }
            res.Add(k);
        }

        foreach (int i in res)
            Console.WriteLine(i);
    }
}