#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const int mod = inf + 7;
const double eps = 1e-9;
const double pi = acos(-1.0);
int n, m, a[1010][1010], ans[1010], q;
void go(int ind) {
  ans[ind] = 0;
  for (int i = 0, j = 0; i < m; i = j) {
    if (a[ind][i] == 0) {
      j = i + 1;
    } else {
      j = i;
      while (j < m && a[ind][j]) j++;
      ans[ind] = max(ans[ind], j - i);
    }
  }
}
int get() { return *max_element(ans, ans + n); }
int main() {
  cin >> n >> m >> q;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cin >> a[i][j];
    go(i);
  }
  for (int i = 0, x, y; i < q; i++) {
    cin >> x >> y;
    x--;
    y--;
    a[x][y] ^= 1;
    go(x);
    printf("%d\n", get());
  }
  return 0;
}
