import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner skener = new Scanner(System.in);
        int n = skener.nextInt();
        int m = skener.nextInt();

        int[] nizd = new int[n];
        int[] nizu = new int[n];
        int[] nizo = new int[m];
        
        for (int i = 0; i < n; i++) {
            nizd[i] = skener.nextInt();
            nizu[i] = skener.nextInt();
        }

        for (int i = 0; i < m; i++) {
            int l = skener.nextInt();
            int r = skener.nextInt();
            int x = skener.nextInt();

            int br = 0;

            for (int j = l - 1; j < r; j++) {
                if(x <= nizu[j] && x >= nizd[j]){
                    br++;
                }
            }

            nizo[i] = br;
        }

        for (int i = 0; i < m; i++) {
            System.out.println(nizo[i]);
        }
    }
}