#include <bits/stdc++.h>
using namespace std;
int b[600][600], n, m, q, row[600];
int main() {
  ios::sync_with_stdio(false);
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      int x;
      scanf("%d", &x);
      b[i][j] = x;
    }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int len = 0;
    int maxlen = 0;
    for (int j = 1; j <= m; j++) {
      if (b[i][j])
        len++;
      else
        len = 0;
      maxlen = max(len, maxlen);
    }
    row[i] = maxlen;
  }
  while (q--) {
    int i, j;
    scanf("%d%d", &i, &j);
    b[i][j] ^= 1;
    int len = 0;
    int maxlen = 0;
    for (j = 1; j <= m; j++) {
      if (b[i][j])
        len++;
      else
        len = 0;
      maxlen = max(len, maxlen);
    }
    row[i] = maxlen;
    int ans = 0;
    for (int ii = 1; ii <= n; ii++) {
      ans = max(ans, row[ii]);
    }
    printf("%d\n", ans);
  }
  return 0;
}
