#include <bits/stdc++.h>
int max(int a, int b) { return a > b ? a : b; }
int a[510][510], num[510], n, m, Q, ans, x, y;
void work(int pos) {
  num[pos] = 0;
  int f = 0;
  for (int i = 1; i <= m; i++)
    if (a[pos][i])
      f++;
    else
      num[pos] = max(num[pos], f), f = 0;
  num[pos] = max(num[pos], f);
}
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++) work(i), ans = max(ans, num[i]);
  for (int t = 1; t <= Q; t++) {
    scanf("%d%d", &x, &y);
    a[x][y] = a[x][y] ^ 1;
    work(x);
    ans = 0;
    for (int i = 1; i <= n; i++) ans = max(ans, num[i]);
    printf("%d\n", ans);
  }
}
