#include <algorithm>
#include <vector>
using namespace std;
#define pb push_back
#define mp make_pair
#define DIM 100005
#define sc second
#define fs first
vector <pair <int,int> > v;
int n,c,q,nrt;
int s[DIM];
void read ()
{
int i,x,y;
scanf ("%d%d",&c,&n);
for (i=1; i<=n; ++i)
{
scanf ("%d%d",&x,&y);
v.pb (mp (x,y));
}
}
struct cmp
{
bool operator () (const pair <int,int> &a,const pair <int,int> &b)
{
return a.sc<b.sc || (a.sc==b.sc && a.fs<b.fs);
}
};
void init ()
{
int i;
sort (v.begin (),v.end (),cmp ());
for (i=1; i<n; ++i)
if (v[i-1].fs==v[i].fs)
s[i]=s[i-1];
else
s[i]=s[i-1]+1;
}
void solve ()
{
int i,x1,x2,y1,y2;
scanf ("%d",&q);
for (i=1; i<=q; ++i)
{
scanf ("%d%d%d%d",&x1,&y1,&x2,&y2);
if (y2<y1)
{
swap (x1,x2);
swap (y1,y2);
}
nrt=y2-y1+1;
y1=upper_bound (v.begin (),v.end (),mp (0,y1),cmp ())-v.begin ();
y2=upper_bound (v.begin (),v.end (),mp (0,y2),cmp ())-v.begin ()-1;
if (y1<=y2)
{
if(x1==v[y1].fs)
++nrt;
if(x2==v[y2].fs)
++nrt;
nrt+=s[y2]-s[y1];
}
else if (x1!=x2)
++nrt;
printf ("%d\n",nrt);
}
}
int main ()
{
freopen ("gropi.in","r",stdin);
freopen ("gropi.out","w",stdout);
read ();
init ();
solve ();
return 0;
}