#include <bits/stdc++.h>
using namespace std;
bool bears[600][600];
vector<int> mxs(600);
long long row, col;
long long maxRow() {
  long long res = 0;
  long long mx = 0;
  long long mxRes = 0;
  for (long long i = 1; i <= row; i++) {
    res = 0;
    mxRes = 0;
    for (long long j = 1; j <= col; j++) {
      if (!bears[i][j]) {
        if (res > mxRes) mxRes = res;
        res = 0;
      }
      res += bears[i][j];
      if (res > mxRes) mxRes = res;
      mxs[i] = mxRes;
    }
    if (mxRes > mx) mx = mxRes;
  }
  return mx;
}
void checkRow(int r) {
  int res = 0;
  int mxRes = 0;
  for (long long j = 1; j <= col; j++) {
    if (!bears[r][j]) {
      if (res > mxRes) mxRes = res;
      res = 0;
    }
    res += bears[r][j];
    if (res > mxRes) mxRes = res;
  }
  mxs[r] = mxRes;
}
int main() {
  long long n, m, k;
  cin >> row >> col >> k;
  for (long long i = 1; i <= row; i++) {
    for (long long j = 1; j <= col; j++) {
      cin >> bears[i][j];
    }
  }
  cin >> n >> m;
  bears[n][m] = !bears[n][m];
  cout << maxRow() << endl;
  for (long long i = 1; i < k; i++) {
    cin >> n >> m;
    bears[n][m] = !bears[n][m];
    checkRow(n);
    cout << *max_element(std::begin(mxs), std::end(mxs)) << endl;
  }
  cin >> n;
}
