import java.util.Scanner;

public class Vage {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int brojVagi = in.nextInt();
        int brojPitanja = in.nextInt();

        int nizVagi[][] = new int[brojVagi][2];
        int nizPitanja[][] = new int[brojPitanja][3];
        int nizResenja[] = new int[brojPitanja];

        for (int i = 0; i < nizVagi.length; i++) {
            for (int j = 0; j < nizVagi[i].length; j++) {
                nizVagi[i][j] = in.nextInt();
            }
        }

        for (int i = 0; i < nizPitanja.length; i++) {
            for (int j = 0; j < nizPitanja[i].length; j++) {
                nizPitanja[i][j] = in.nextInt() - 1;
            }
            nizPitanja[i][2] += 1;

            for (int j = nizPitanja[i][0]; j <= nizPitanja[i][1]; j++) {
                if (nizVagi[j][0] <= nizPitanja[i][2] && nizVagi[j][1] >= nizPitanja[i][2]) {
                    nizResenja[i]++;
                }
            }
            System.out.println(nizResenja[i]);
        }

    }

}