string [] s = Console.ReadLine().Split();
int N = int.Parse(s[0]);
int M = int.Parse(s[1]);
int [] donjaGranica = new int[N];
int [] gornjaGranica = new int[N];
int l, r, x;
int komb;
int [] res = new int [M];
for (int i = 0; i < N; i++)
{
    string [] a = Console.ReadLine().Split();
     donjaGranica[i] = int.Parse(a[0]);
     gornjaGranica[i] = int.Parse(a[1]);
}
for (int i = 0; i < M; i++)
{
    string[] b = Console.ReadLine().Split();
     l = int.Parse(b[0]);
     r = int.Parse(b[1]);
     x = int.Parse(b[2]);
    komb = 0;
    for (int j = l - 1; j <= r - 1; j++)
    {

        if (x <= gornjaGranica[j] && x >= donjaGranica[j]) komb++;
        
    }
    res[i] = komb;
}
for (int i = 0; i < M; i++)
{
    Console.WriteLine(res[i]);
}