using System;
					
public class Program
{
	public static void Main()
	{
		string[] data = Console.ReadLine().Split(' ');
int n = int.Parse(data[0]);
int m = int.Parse(data[1]);

int[,] a = new int[n,2];
for (int i = 0; i < n; i++)
{
    data = Console.ReadLine().Split(' ');
    a[i, 0] = int.Parse(data[0]);
    a[i, 1] = int.Parse(data[1]);
}

int[] p = new int[m];
for (int i = 0; i < m; i++)
{
    int temp = 0;
    data = Console.ReadLine().Split(' ');
    int o = int.Parse(data[0]) - 1;
    int r = int.Parse(data[1]) - 1;
    int x = int.Parse(data[2]);
    for (int j = o; j <= r; j++)
    {
        if (a[j, 0] <= x && a[j, 1] >= x)
        {
            temp++;
        }
    }

    p[i] = temp;
}

for (int i = 0; i < m; i++)
{ 
    Console.WriteLine(p[i]);
}


	}
}