#include <bits/stdc++.h>
using namespace std;
int n, ans = 0, sum = 0, k, q, zak, m;
int maxi = 0, x, y, p[10000];
int a[510][510];
int main() {
  cin >> n >> m >> q;
  for (int i(1); i <= n; i++)
    for (int j(1); j <= m; j++) cin >> a[i][j];
  for (int i(1); i <= q; i++) {
    cin >> x >> y;
    a[x][y] = abs(a[x][y] - 1);
    for (int j(1); j <= n; j++) {
      for (int k(1); k <= m; k++) {
        if (a[j][k] == 1)
          zak++;
        else
          zak = 0;
        if (zak > maxi) maxi = zak;
      }
      zak = 0;
    }
    p[i] = maxi;
    maxi = 0;
  }
  for (int i(1); i <= q; i++) cout << p[i] << endl;
  return 0;
}
