#include <bits/stdc++.h>
using namespace std;
int a[505][505];
int track[505];
int main() {
  memset(track, 0, sizeof(track));
  int n, m, q, c, t;
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf("%d", &a[i][j]);
    }
  }
  for (int i = 1; i <= n; i++) {
    c = t = 0;
    for (int j = 1; j <= m; j++) {
      if (a[i][j] == 0) {
        c = max(c, t);
        t = 0;
      } else {
        t++;
      }
    }
    c = max(c, t);
    track[i] = c;
  }
  int x, y;
  while (q--) {
    scanf("%d %d", &x, &y);
    a[x][y] = a[x][y] ^ 1;
    c = t = 0;
    for (int j = 1; j <= m; j++) {
      if (a[x][j] == 0) {
        c = max(c, t);
        t = 0;
      } else {
        t++;
      }
    }
    c = max(c, t);
    track[x] = c;
    int ams = 0;
    for (int i = 1; i <= n; i++) {
      ams = max(ams, track[i]);
    }
    printf("%d\n", ams);
  }
  return 0;
}
