import java.util.Scanner;

public class Test {
	static class vaga
	{
		int donja, gornja;
		public vaga(int x, int y)
		{
			donja = x;
			gornja = y;
		}
	}
	static class info {
		int l, r, x;
		public info(int p, int q, int n)
		{
			l = p;
			r = q;
			x = n;
		}
	}
	static int situacija(vaga[] a, int l, int r, int x)
	{
		int s = 0;
		for (int i = l - 1; i < r; i++) {
			if(x >= a[i].donja && x <= a[i].gornja)
				s++;
		}
		return s;
	}
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int m = in.nextInt();
		vaga[] a = new vaga[n];
		for (int i = 0; i < n; i++)
			a[i] = new vaga(in.nextInt(), in.nextInt());
		info[] b = new info[m];
		for (int i = 0; i < m; i++)
			b[i] =  new info(in.nextInt(), in.nextInt(), in.nextInt());
		for (int i = 0; i < m; i++)
			System.out.println(situacija(a, b[i].l,  b[i].r,  b[i].x));
		in.close();
	}
}