#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, q, mat[510][510], maxn[510];
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++) {
    int res = 0, k = 0;
    for (int j = 1; j <= m; j++) {
      scanf("%d", &mat[i][j]);
      if (mat[i][j] == 1)
        k++;
      else
        k = 0;
      res = max(res, k);
    }
    maxn[i] = res;
  }
  int r, c;
  while (q--) {
    scanf("%d%d", &r, &c);
    mat[r][c] = 1 - mat[r][c];
    int res = 0, k = 0;
    for (int j = 1; j <= m; j++) {
      if (mat[r][j] == 1)
        k++;
      else
        k = 0;
      res = max(res, k);
      maxn[r] = res;
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) ans = max(ans, maxn[i]);
    printf("%d\n", ans);
  }
  return 0;
}
