// C++ 14
#include <bits/stdc++.h>
using namespace std;
template <typename T>  ostream& operator<<(ostream& os, const vector<T>& v)  {  os << "[";  for (int i = 0; i < v.size(); ++i) {  os << v[i];  if (i != v.size() - 1)  os << ", ";  }  os << "]";  return os;  }
template <typename T> void print(T v, string s = "\n") { cout << v << s; }
template <typename T> void in(T &v) { cin >> v; }
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

int G[500][500];
int ACC[501][501];

int main() {
  int n, m, q; in(n),in(m),in(q);
  loop(i,0,m) {
    int l, r; in(l),in(r);
    l--;r--;
    G[l][r]++;
  }
  
  loop(y,0,n) {
    loop(x,0,n) {
      ACC[y+1][x+1] = ACC[y+1][x] + ACC[y][x+1] - ACC[y][x] + G[y][x];
    }
  }
  
  // loop(y,0,n+1) {
  //   loop(x,0,n+1) {
  //     print(ACC[y][x], " ");
  //   }
  //   print("");
  // }
  
  loop(i,0,q) {
    int l,r; in(l),in(r);
    int cnt = ACC[r][r];
    cnt += ACC[l-1][l-1];
    cnt -= ACC[l-1][r];
    cnt -= ACC[r][l-1];
    // print(ACC[r][r]);
    // print(ACC[l-1][l-1]);
    // print(ACC[l-1][r]);
    // print(ACC[r][l-1]);
    print(cnt);
  }
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

pair<int, bool> P[100001];
bool dame[100001];

pair<int, bool> Find(int A) {
	if (P[A].first < 0) return mp(A, 0);
	auto p = Find(P[A].first);
	P[A].first = p.first;
	P[A].second ^= p.second;
	return P[A];
}

bool Unite(int A, int B) {
	auto a = Find(A);
	auto b = Find(B);
	if (a.first == b.first) {
		if(a.second == b.second) dame[a.first] = true;
		return false;
	}
	if (P[a.first].first > P[b.first].first) swap(a, b);
	P[a.first].first += P[b.first].first;
	dame[a.first] |= dame[b.first];
	P[b.first] = mp(a.first, !(a.second ^ b.second));
	return true;
}

int Size(int A) {
	return -P[Find(A).first].first;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	int N = getint(), M = getint();
	rep1(i, N) P[i] = mp(-1, 0);
	rep(i, M) {
		int a = getint(), b = getint();
		Unite(a, b);
	}

	ll x = 0, y = 0, z = 0;
	rep1(i, N) {
		if (Find(i).first == i) {
			if (Size(i) > 1) {
				if (dame[i]) y++;
				else x++;
			}
			else z++;
		}
	}
	co(x * x + (x + y) * (x + y) + 2 * N * z - z * z);

	Would you please return 0;
}