#include <bits/stdc++.h>
using namespace std;
int res[510];
int main() {
  int n, m, q, cnt, mxx, max_of_res;
  int grid[510][510];
  int x, y;
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      scanf("%d", &grid[i][j]);
    }
  for (int i = 1; i <= n; i++) {
    mxx = 0;
    cnt = 0;
    for (int j = 1; j <= m; j++) {
      if (grid[i][j] == 1) {
        cnt++;
        mxx = max(mxx, cnt);
      } else
        cnt = 0;
    }
    res[i] = mxx;
  }
  for (int i = 1; i <= q; i++) {
    scanf("%d%d", &x, &y);
    if (grid[x][y] == 0) {
      grid[x][y] = 1;
      cnt = 0;
      mxx = 0;
      for (int j = 1; j <= m; j++) {
        if (grid[x][j] == 1) {
          cnt++;
          mxx = max(mxx, cnt);
        } else
          cnt = 0;
      }
      res[x] = mxx;
    } else {
      grid[x][y] = 0;
      mxx = 0;
      cnt = 0;
      for (int j = 1; j <= m; j++) {
        if (grid[x][j] == 1) {
          cnt++;
          mxx = max(mxx, cnt);
        } else
          cnt = 0;
      }
      res[x] = mxx;
    }
    max_of_res = 0;
    for (int i = 1; i <= n; i++) max_of_res = max(max_of_res, res[i]);
    printf("%d\n", max_of_res);
  }
  return 0;
}
