1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#include<bits/stdc++.h>
using namespace std;
template <typename T> T getczary(){//magia!
  int ujemna = false, znak = getchar_unlocked();
  T wynik = (T)0;
  while(!isdigit(znak)){
    if(znak == '-')
      ujemna = true;
    znak = getchar_unlocked();
  }
  while(isdigit(znak)){
    wynik *= 10;
    wynik += znak - '0';
    znak = getchar_unlocked();
  }
  if(ujemna)
    wynik *= -1;
  return wynik;
}
#define pc(x) putchar_unlocked(x);
inline void kout(int n){
  int N = n, rev, count = 0;
  rev = N;
  if (N == 0) { pc('0'); pc('\n'); return ;}
  while ((rev % 10) == 0) { count++; rev /= 10;}
  rev = 0;
  while (N != 0) { rev = (rev<<3) + (rev<<1) + N % 10; N /= 10;}
  while (rev != 0) { pc(rev % 10 + '0'); rev /= 10;}
  while (count--) pc('0');
  pc('\n');
}
bool cyrkowcy[2007][2007];
int n, k;
vector<int> g[2007], mt;
vector<bool> used;

bool try_kuhn(int v){
  if(used[v])
    return false;
  used[v] = true;
  for(int to : g[v]){
    if(mt[to] == -1 || try_kuhn(mt[to])){
      mt[to] = v;
      return true;
    }
  }
  return false;
}
int N, m, q;
int t[2007][2007];
int maks_skojarzenie(){
  int nr[2] = {0, 0};
  for(int i = 1;i <= N;i++){
    g[i].clear();
    for(int j = 1;j <= N;j++)
      t[i][j] = ++nr[cyrkowcy[i][j]];
  }
  for(int i = 1;i <= N;i++){
    for(int j = 1;j <= N;j++){
      if(cyrkowcy[i][j] == 1) continue;
      for(int z = 1;z <= N;z++){
        if(cyrkowcy[i][j] != cyrkowcy[i][z]){
          g[t[i][j]].push_back(t[i][z]);
        }
        if(cyrkowcy[i][j] != cyrkowcy[z][j]){
          g[t[i][j]].push_back(t[z][j]);
        }
      }
    }
  }

  n = nr[0]; k = nr[1];
  mt.assign(k + 7, -1);
  vector<bool> used1(n + 7, false);
  for(int v = 1;v <= n;++v){
    for(int to : g[v]){
      if(mt[to] == -1){
        mt[to] = v;
        used1[v] = true;
        break;
      }
    }
  }
  for(int v = 1;v <= n;++v){
    if(used1[v])
      continue;
    used.assign(n + 7, false);
    try_kuhn(v);
  }
  int res = 0;
  for(int i = 1;i <= k;++i)
    if(mt[i] != -1)
      res++;
  return res;
}
int main(){
  N = getczary<int>();
  m = getczary<int>();
  q = getczary<int>();
  for(int i = 0, x1, y1, x2, y2;i < m;i++){
    x1 = getczary<int>();
    y1 = getczary<int>();
    x2 = getczary<int>();
    y2 = getczary<int>();
    for(int x = x1;x <= x2;x++)
      for(int y = y1;y <= y2;y++)
        cyrkowcy[x][y] ^= 1;
  }
  kout(maks_skojarzenie());
  for(int i = 0, x, y;i < q;i++){
    x = getczary<int>();
    y = getczary<int>();
    cyrkowcy[x][y] ^= 1;
    kout(maks_skojarzenie());
  }
}