#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, q, i, j, ans = 0;
  ;
  int b[505];
  int a[505][505];
  cin >> n >> m >> q;
  for (i = 0; i < n; i++) {
    int c = 0, maxr = 0;
    ;
    for (j = 0; j < m; j++) {
      cin >> a[i][j];
      if (a[i][j] == 1)
        c++;
      else {
        maxr = max(c, maxr);
        c = 0;
      }
    }
    maxr = max(c, maxr);
    b[i] = maxr;
    ans = max(ans, b[i]);
  }
  int l, r;
  while (q--) {
    cin >> l >> r;
    a[l - 1][r - 1] = 1 - a[l - 1][r - 1];
    int c = 0, maxr = 0;
    ;
    for (i = 0; i < m; i++) {
      if (a[l - 1][i] == 1)
        c++;
      else {
        maxr = max(c, maxr);
        c = 0;
      }
    }
    maxr = max(maxr, c);
    b[l - 1] = maxr;
    ans = 0;
    for (i = 0; i < n; i++) ans = max(ans, b[i]);
    cout << ans << endl;
  }
  return 0;
}
