#include <bits/stdc++.h>
using namespace std;
int E[501][501];
int n, m, q;
int count(int i) {
  int ma = 0, tmp = 0;
  for (int c = 0; c < m; c++) {
    if (!E[i][c])
      tmp = 0;
    else
      ma = max(ma, ++tmp);
  }
  return ma;
}
int main(void) {
  cin >> n >> m >> q;
  for (int r = 0; r < n; r++)
    for (int c = 0; c < m; c++) {
      int v;
      cin >> v;
      E[r][c] = v;
    }
  multiset<int> ms;
  for (int r = 0; r < n; r++) {
    ms.insert(count(r));
  }
  for (int it = 0; it < q; it++) {
    int i, j;
    cin >> i >> j;
    --i;
    --j;
    int pre = count(i);
    ms.erase(ms.find(pre));
    E[i][j] ^= 1;
    int post = count(i);
    ms.insert(post);
    cout << *ms.rbegin() << endl;
  }
  return 0;
}
