#include <bits/stdc++.h>
int arr[501][501], cnt_table[501], q, maxi, n, m, x, y, cnt;
int max(int a, int b) { return (a > b ? a : b); }
int main() {
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 0; i < n; i++) {
    maxi = cnt = 0;
    for (int j = 0; j < m; j++) {
      scanf("%d", &arr[i][j]);
      if (arr[i][j])
        cnt++;
      else
        cnt = 0;
      maxi = max(maxi, cnt);
    }
    cnt_table[i] = maxi;
  }
  while (q--) {
    maxi = cnt = 0;
    scanf("%d %d", &x, &y);
    arr[x - 1][y - 1] ^= 1;
    for (int i = 0; i < m; i++) {
      if (arr[x - 1][i])
        cnt++;
      else
        cnt = 0;
      maxi = max(maxi, cnt);
    }
    cnt_table[x - 1] = max(maxi, cnt);
    maxi = 0;
    for (int i = 0; i < n; i++) {
      maxi = max(maxi, cnt_table[i]);
    }
    printf("%d\n", maxi);
  }
  return 0;
}
