#include <bits/stdc++.h>
using namespace std;
int a[510][510], ans[510];
int main() {
  int n, m, q, i, j, ajcnt, x, y;
  cin >> n >> m >> q;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  }
  for (i = 1; i <= n; i++) {
    ajcnt = 0;
    for (j = 1; j <= m; j++) {
      if (a[i][j] == 1 && j > 1 && a[i][j - 1] == 1) {
        ajcnt++;
      } else if (a[i][j] == 1) {
        ajcnt = 1;
      } else {
        ajcnt = 0;
      }
      ans[i] = max(ans[i], ajcnt);
    }
  }
  for (i = 1; i <= q; i++) {
    cin >> x >> y;
    if (a[x][y])
      a[x][y] = 0;
    else
      a[x][y] = 1;
    ajcnt = 0;
    ans[x] = 0;
    for (j = 1; j <= m; j++) {
      if (a[x][j] == 1 && j > 1 && a[x][j - 1] == 1) {
        ajcnt++;
      } else if (a[x][j] == 1) {
        ajcnt = 1;
      } else {
        ajcnt = 0;
      }
      ans[x] = max(ans[x], ajcnt);
    }
    cout << *max_element(ans, ans + 500) << endl;
  }
}
