#include <bits/stdc++.h>
using namespace std;
int bears[505][505];
int ans[505];
int m, n, q;
void calc(int i) {
  ans[i] = 0;
  int curr = 0;
  for (int j = 0; j < n; j++) {
    if (bears[i][j])
      curr++;
    else
      curr = 0;
    ans[i] = max(ans[i], curr);
  }
}
int main() {
  cin >> m >> n >> q;
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) cin >> bears[i][j];
    calc(i);
  }
  while (q--) {
    int x, y;
    cin >> x >> y;
    bears[x - 1][y - 1] ^= 1;
    int a = 0;
    calc(x - 1);
    for (int i = 0; i < m; i++) a = max(ans[i], a);
    cout << a << endl;
  }
  return 0;
}
