#include <bits/stdc++.h>
using namespace std;
int T[2010];
int A[505][505];
int n, m, M, q;
int GetScore(int *A) {
  int rtn = 0, cur = 0;
  for (int i = 0; i <= m; i++) {
    if (i == m || A[i] == 0) {
      rtn = max(rtn, cur);
      cur = 0;
    } else
      cur++;
  }
  return rtn;
}
void PushUp(int x) { T[x] = max(T[x << 1], T[x << 1 | 1]); }
void build(int n) {
  for (M = 1; M <= n + 1; M <<= 1)
    ;
  for (int i = 0; i < n; i++) {
    T[M + i] = GetScore(A[i]);
  }
  for (int i = M - 1; i > 0; i--) PushUp(i);
}
void Update(int x, int v) {
  for (T[x += M] = v; x;) {
    PushUp(x >>= 1);
  }
}
int main() {
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      scanf("%d", &A[i][j]);
    }
  }
  build(n);
  while (q--) {
    int r, c;
    scanf("%d %d", &r, &c);
    r--;
    c--;
    A[r][c] ^= 1;
    int v = GetScore(A[r]);
    Update(r, v);
    printf("%d\n", T[1]);
  }
  return 0;
}
