#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> PII;

struct sf {
	int l,r,par,rev;
	int id,mx;
};
sf f[310000];
PII e[210000];
int tr[110000];
vector<PII> ask[110000];
vector<int> a[110000];
int ans[110000];
int n,m,q;

inline bool isroot(int x) {
	return f[f[x].par].l!=x && f[f[x].par].r!=x;
}

inline void push(int x) {
	if (f[x].rev) {
		f[f[x].l].rev^=1;
		f[f[x].r].rev^=1;
		swap(f[x].l,f[x].r);
		f[x].rev=0;
	}
}

inline void update(int x) {
	f[x].mx=f[x].id;
	if (e[f[f[x].l].mx].first<e[f[x].mx].first) f[x].mx=f[f[x].l].mx;
	if (e[f[f[x].r].mx].first<e[f[x].mx].first) f[x].mx=f[f[x].r].mx;
}

inline void rotate(int x) {
	int y=f[x].par,z=f[y].par;
	push(y);push(x);
	if (f[y].l==x) f[f[y].l=f[x].r].par=y,f[x].r=y;
	else f[f[y].r=f[x].l].par=y,f[x].l=y;
	if (f[z].l==y) f[z].l=x;
	if (f[z].r==y) f[z].r=x;
	f[f[y].par=x].par=z;
	update(y);
}

inline void splay(int x) {
	push(x);
	for (;!isroot(x);rotate(x)) {
		int y=f[x].par,z=f[y].par;
		if (!isroot(y)) rotate(f[z].l==y^f[y].l==x?x:y);
	}
	update(x);
}

inline void access(int x) {
	for(int t=0,y=x;y;y=f[y].par) splay(y),f[y].r=t,update(t=y);
	splay(x);
}

inline void makeroot(int x) {
	access(x);f[x].rev^=1;
}

inline void link(int x,int y) {
	makeroot(x);f[x].par=y;
}

inline void cut(int x,int y) {
	makeroot(x);access(y);f[x].par=f[y].l=0;update(y);
}

inline int query(int x,int y) {
	makeroot(x);access(y);
	return f[f[y].l].mx;
}

void ins(int x,int y) {
	while (x<=n) tr[x]+=y,x+=x&-x;
}

int get(int x) {
	int ret=0;
	while (x>0) ret+=tr[x],x-=x&-x;
	return ret;
}

int main() {
	while (scanf("%d%d%d",&n,&m,&q)==3) {
		for (int i=0;i<m;i++) {
			int x,y;
			scanf("%d%d",&x,&y);
			if (x>y) swap(x,y);
			if (x!=y) a[y].push_back(x);
		}
		for (int i=0;i<q;i++) {
			int x,y;
			scanf("%d%d",&x,&y);
			ask[y].push_back(PII(x,i));
		}
		int cnt=0;
		e[0].first=n+1;
		for (int x=1;x<=n;x++) {
			for (int i=0;i<a[x].size();i++) {
				int y=a[x][i],t=y;
				int flag=1;
				makeroot(x);
				access(y);
				while (f[y].l) y=f[y].l;
				splay(y);
				if (y==x) {
					int u=query(x,t);
					if (e[u].first>=t) flag=0;
					else {
						cut(n+u,e[u].first);
						cut(n+u,e[u].second);
						ins(n-e[u].first+1,-1);
					}
				}
				if (flag) {
					cnt++;
					e[cnt].first=t;
					e[cnt].second=x;
					f[n+cnt].id=cnt;
					link(n+cnt,t);
					link(n+cnt,x);
					ins(n-t+1,1);
				}
			}
			for (int i=0;i<ask[x].size();i++) {
				int y=ask[x][i].first;
				int id=ask[x][i].second;
				ans[id]=n-get(n-y+1);
			}
		}
		for (int i=0;i<q;i++) printf("%d\n",ans[i]);
		for (int i=1;i<=n;i++) {
			a[i].clear();
			ask[i].clear();
			tr[i]=0;
		}
		memset(f,0,sizeof(sf)*(n+cnt+1));
	}
}
