#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define AC "test"
#define foru(i, l, r) for (int i = (l); i <= (r); i++)
#define ford(i, l, r) for (int i = (l); i >= (r); i--)
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vii;
typedef vector<ll> vll;
const ll inf = 1e9 + 7;
const ll linf = 1e18 + 7;
const int mod = 1e9 + 7;
const int maxn = 1e2 + 7;
const int base = 31;
void fastIO(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
}
ll mul(ll a, ll b){
a%=mod;
ll res = 0;
while (b){
if (b%2) res = (res + a)%mod;
a = (a + a)%mod;
b/=2;
}
return res;
}
ll Pow(ll a, ll b){
ll ans = 1;
while (b){
if (b % 2) ans = mul(ans, a);
a = mul(a, a);
b/=2;
}
return ans;
}
int n, k, q, res, a[maxn][maxn], b[maxn][maxn], x, r, c, val;
void solve(){
cin >> n >> k >> q;
foru(i, 1, k){
cin >> r >> c >> x;
b[r][c] = x;
foru(j, 1, r - 1){
a[j][c] ^= x;
}
foru(j, r + 1, n){
a[j][c] ^= x;
}
foru(j, 1, c - 1){
a[r][j] ^= x;
}
foru(j, c + 1, n){
a[r][j] ^= x;
}
}
foru(i, 1, n){
foru(j, 1, n){
if (a[i][j]) res++;
}
}
foru(i, 1, q){
cin >> r >> c;
x = b[r][c];
foru(j, 1, r - 1){
val = a[j][c] ^ x;
if (a[j][c] && !val) res--;
else if (!a[j][c] && val) res++;
a[j][c] = val;
}
foru(j, r + 1, n){
val = a[j][c] ^ x;
if (a[j][c] && !val) res--;
else if (!a[j][c] && val) res++;
a[j][c] = val;
}
foru(j, 1, c - 1){
val = a[r][j] ^ x;
if (a[r][j] && !val) res--;
else if (!a[r][j] && val) res++;
a[r][j] = val;
}
foru(j, c + 1, n){
val = a[r][j] ^ x;
if (a[r][j] && !val) res--;
else if (!a[r][j] && val) res++;
a[r][j] = val;
}
cin >> r >> c;
b[r][c] = x;
foru(j, 1, r - 1){
val = a[j][c] ^ x;
if (a[j][c] && !val) res--;
else if (!a[j][c] && val) res++;
a[j][c] = val;
}
foru(j, r + 1, n){
val = a[j][c] ^ x;
if (a[j][c] && !val) res--;
else if (!a[j][c] && val) res++;
a[j][c] = val;
}
foru(j, 1, c - 1){
val = a[r][j] ^ x;
if (a[r][j] && !val) res--;
else if (!a[r][j] && val) res++;
a[r][j] = val;
}
foru(j, c + 1, n){
val = a[r][j] ^ x;
if (a[r][j] && !val) res--;
else if (!a[r][j] && val) res++;
a[r][j] = val;
}
cout << res << "\n";
}
}
int main(){
fastIO();
if (fopen(AC".inp", "r")){
freopen(AC".inp", "r", stdin);
freopen(AC".out", "w", stdout);
}
solve();
}