#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 0, m = 0, q = 0;
  scanf("%d%d%d", &n, &m, &q);
  int **a = new int *[n];
  int *b = new int[n];
  int w = 0, ma = 0;
  for (int i = 0; i < n; i++) {
    a[i] = new int[m];
    w = 0;
    ma = 0;
    for (int j = 0; j < m; j++) {
      scanf("%d", &a[i][j]);
      if (a[i][j] == 1) {
        w++;
      } else {
        ma = max(w, ma);
        w = 0;
      }
    }
    b[i] = max(w, ma);
  }
  int x, y;
  for (int i = 0; i < q; i++) {
    scanf("%d%d", &x, &y);
    x--;
    y--;
    if (a[x][y] == 1) {
      a[x][y] = 0;
    } else {
      a[x][y] = 1;
    }
    w = 0;
    ma = 0;
    for (int j = 0; j < m; j++) {
      if (a[x][j] == 1) {
        w++;
      } else {
        ma = max(w, ma);
        w = 0;
      }
    }
    b[x] = max(w, ma);
    w = 0;
    for (int j = 0; j < n; j++) {
      w = max(w, b[j]);
    }
    printf("%d\n", w);
  }
  return 0;
}
