#include <bits/stdc++.h>
using namespace std;
int a[555][555], ans[555];
int n, m, q;
void calc(int i) {
  ans[i] = 0;
  for (int j = 1; j <= m;) {
    if (a[i][j] == 0) {
      ++j;
      continue;
    }
    int k;
    for (k = j + 1; k <= m && a[i][k] == 1; k++)
      ;
    ans[i] = max(ans[i], k - j);
    j = k;
  }
}
int main() {
  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++) calc(i);
  for (int i = 1; i <= q; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    a[x][y] = 1 - a[x][y];
    calc(x);
    int p = 0;
    for (int j = 1; j <= n; j++) p = max(p, ans[j]);
    printf("%d\n", p);
  }
  return 0;
}
