type point =record x, y : integer; end;

type sir = array[0..50]of point;
     list = array[0..50]of integer;
     bilist = array[0..18] of list;
var P: sir; X:list; T : bilist;
    i, n, m, x1, y1, x2, y2, v : word;
    
function cmp (i, j : point):integer;
begin cmp:=i.x-j.x; end;

procedure build(lv, l, r:integer);
var m,i,j,k:integer;
begin
  m := (l + r) shr 1 ;
  if (l = r) then T[lv][l] := P[l].y
  else begin
   build(lv+1,l,m); build(lv+1, m+1,r);
   i:=l; j:=m+1; k:=l;
   while (i<=m)or(j<=r) do
   if (j>r)or(i<=m)and(T[lv+1,i]<T[lv+1,j]) 
   then begin
     T[lv,k]:=T[lv+1][i];inc(k);inc(i);end
    else begin
     T[lv,k]:=T[lv+1,j];inc(k);inc(j);end
  end; end;

function search(A:list;l,r,v:integer):
                                 integer;
var t, step, p:integer;
begin
 if (v < A[l]) then search:=l-1;
 step:=1;
 while step<(r-l+1) do step:= step shl 1;
  p:=l;
  while step>0  do begin
    if (p+step<=r)and(A[p+step]<=v)then
                inc(p,step);
     step:= step shr 1;
  end; search:=p; end;

function query (lv, l, r:  word):word;
var m, tt:word;
begin
   tt := 0;
   if (x1 <= l) and (r <= x2) then begin
     if (y2 < T[lv][l])or(y1 > T[lv][r]) 
        then tt :=0
     else
     if (y1<T[lv][l])and(T[lv][r]<y2) then
        tt:=r-l+1
     else
       tt:=search(T[lv],l,r,y2)-
           search(T[lv],l,r,y1-1) end
  else begin
    m := (l + r) shr 1;
    if x1<=m then tt:=tt+query(lv+1, l, m);
    if x2>m then tt:=tt+query(lv+1,m+1, r);
  end;
  query:=tt; end;

procedure QuickSort(var A: sir; Lo, Hi: Integer);
procedure Sort(l, r: Integer);
var i, j: integer; x, y : point;
begin
  i := l; j := r; x := a[(l+r) DIV 2];
  repeat
    while cmp(a[i],x) < 0 do i := i + 1;
    while cmp(x,a[j]) < 0 do j := j - 1;
    if i <= j then begin
      y := a[i]; a[i] := a[j]; a[j] := y;
      i := i + 1; j := j - 1; end;
  until i > j;
  if l < j then Sort(l, j);
  if i < r then Sort(i, r);
end;
begin  Sort(Lo,Hi); end;

begin
 assign(input, 'puncte.in'); reset(input);
 assign(output, 'puncte.out'); 
 rewrite(output); readln(n, m);
 for i:=0 to N-1 do readln(P[i].x, P[i].y);
 QuickSort(P, 0, N-1);
 for i := 0 to N - 1 do  X[i]:= P[i].x;
 build(0, 0, N - 1);
 while M>0 do begin
  readln(x1, y2, x2, y1);
  if (x2<X[0])or(x1> X[N-1])then writeln(0)
  else begin
    x1 := search(X, 0, N - 1, x1 - 1) + 1;
    x2 := search(X, 0, N - 1, x2);
    writeln(query(0, 0, N - 1));
  end; 
 dec(m);end; 
close(output);end.
