#include <bits/stdc++.h>
using namespace std;
int a[510][510];
int main() {
  int i, n, m, q, x, y, j, k, score, cn;
  cin >> n >> m >> q;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) cin >> a[i][j];
  for (i = 0; i < q; i++) {
    cin >> x >> y;
    a[x][y] = !a[x][y];
    score = 0;
    for (k = 1; k <= n; k++) {
      cn = 0;
      for (j = 1; j <= m; j++) {
        if (a[k][j])
          cn++;
        else
          cn = 0;
        score = max(cn, score);
      }
    }
    cout << score << endl;
  }
}
