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
117
118
119
120
121
122
123
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
int n;
bool ch[2010][2010];
bool tab[2010][2010];
int mtch[4000010];
bool vis[4000010]; 
bool kk[4000010]; 
vector<int> e[4000010];
inline int f(int x,int y)
{
	return (x-1)*n+y-1;
}
bool dfs(int x)
{
	vis[x]=true;
	for(auto v:e[x])
	{
		if(mtch[v]==-1)
		{
			mtch[v]=x;
			mtch[x]=v;
			return true;
		}
	}
	for(auto v:e[x])
	{
		if((!vis[mtch[v]])&&dfs(mtch[v]))
		{
			mtch[x]=v;
			mtch[v]=x;
			return true;
		}
	}
	return false;
}
inline int solve()
{
	for(int i=0;i<=n*n;i++)
	{
		e[i].clear();
		mtch[i]=-1;
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			kk[f(i,j)]=tab[i][j];
			for(int k=1;k<=n;k++)
			{
				if(tab[i][j]!=tab[i][k])
					e[f(i,j)].push_back(f(i,k));
				if(tab[i][j]!=tab[k][j])
					e[f(i,j)].push_back(f(k,j));
			}
		}
	}
	int ans=0;
	while(true)
	{
		bool cont=false;
		for(int i=0;i<=n*n;i++)
		{
			if(kk[i]&&(!vis[i])&&(mtch[i]==-1))
			{
				if(dfs(i))
				{
					cont=true;
					ans++;
				}
			}
		}
		for(int i=0;i<=n*n;i++)
			vis[i]=false;
		if(!cont)
			break;
	}
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int m,x1,y1,x2,y2,q,i,j;
	cin>>n>>m>>q;
	for(i=1;i<=m;i++)
	{
		cin>>x1>>y1>>x2>>y2;
		ch[x1][y1]^=1;
		ch[x1][y2+1]^=1;
		ch[x2+1][y1]^=1;
		ch[x2+1][y2+1]^=1;
		/*for(i=1;i<=n;i++)
		{
			for(j=1;j<=n;j++)
			{
				cerr<<ch[i][j]<<" ";
			}
			cerr<<"\n";
		}*/
	}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=n;j++)
		{
			ch[i+1][j]^=ch[i][j];
			tab[i][j]=tab[i][j-1]^ch[i][j];
			//cerr<<tab[i][j]<<" ";
		}
		//cerr<<"\n";
	}
	cout<<solve()<<"\n";
	while(q--)
	{
		cin>>x1>>y1;
		tab[x1][y1]^=1;
		cout<<solve()<<"\n";
	}
	return 0;
}