using System;
using System.Collections.Generic;
using System.Security;
class Program
{
    static void Main(string[] args)
    {
        string[] s = Console.ReadLine().Split();
        long n = int.Parse(s[0]);
        long m = int.Parse(s[1]);
        long[] d = new long[n + 1];
        long[] u = new long[n + 1];
        for (int i = 1; i <= n; i++)
        {
            string[] ss = Console.ReadLine().Split();
            d[i] = long.Parse(ss[0]);
            u[i] = long.Parse(ss[1]);
        }
        long[] l = new long[m];
        long[] r = new long[m];
        long[] x = new long[m];

        for (int i = 0; i < m; i++)
        {
            string[] sss = Console.ReadLine().Split();
            l[i] = long.Parse(sss[0]);
            r[i] = long.Parse(sss[1]);
            x[i] = long.Parse(sss[2]);
        }

        for (long i = 0; i < m; i++)
        {
            int brojac = 0;
            for (long j = l[i]; j <= r[i]; j++)
            {
                if (d[j] <= x[i] && x[i] <= u[j]) brojac++;
            }
            Console.WriteLine(brojac);
        }
    }
}