#include <bits/stdc++.h>
int main() {
  int map[505][505];
  int n, m, q;
  while (scanf("%d%d%d", &n, &m, &q) != EOF) {
    int total, ans;
    for (int i = 1; i <= n; i++) {
      total = 0;
      ans = 0;
      for (int j = 1; j <= m; j++) {
        scanf("%d", &map[i][j]);
        if (!map[i][j]) total = 0;
        total += map[i][j];
        ans = ((total) > (ans) ? (total) : (ans));
      }
      map[i][0] = ans;
    }
    int x, y;
    for (int i = 0; i < q; i++) {
      scanf("%d%d", &x, &y);
      if (map[x][y]) {
        map[x][y] = 0;
      } else {
        map[x][y] = 1;
      }
      total = 0;
      ans = 0;
      for (int j = 1; j <= m; j++) {
        if (!map[x][j]) total = 0;
        total += map[x][j];
        ans = ((total) > (ans) ? (total) : (ans));
      }
      map[x][0] = ans;
      int answer = 0;
      for (int j = 1; j <= n; j++) {
        if (map[j][0] > answer) {
          answer = map[j][0];
        }
      }
      printf("%d\n", answer);
    }
  }
}
