#include <bits/stdc++.h>
int n, m, q;
short int a[500][500] = {0};
int find_max(int i) {
  int j, temp = 0, rs = 0;
  for (j = 0; j < m; j++)
    if (a[i][j] == 1)
      temp++;
    else {
      rs = (rs > temp) ? rs : temp;
      temp = 0;
    }
  return (rs > temp) ? rs : temp;
}
int main() {
  int i, j, max[500] = {0}, tmax = 0;
  scanf("%d%d%d", &n, &m, &q);
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) scanf("%hd", &a[i][j]);
    max[i] = find_max(i);
    tmax = (tmax > max[i]) ? tmax : max[i];
  }
  while (q-- > 0) {
    scanf("%d%d", &i, &j);
    i--;
    j--;
    a[i][j] = 1 - a[i][j];
    max[i] = find_max(i);
    tmax = -1;
    for (i = 0; i < n; i++) tmax = (tmax > max[i]) ? tmax : max[i];
    printf("%d\n", tmax);
  }
  return 0;
}
