#include <bits/stdc++.h>
using namespace std;
int maps[505][505], rec[505];
int m, n, q, x, y, maa = 0;
int js(int X) {
  int tmp = 0, ans = 0;
  for (int i = (0); i <= (m - 1); i++) {
    if (maps[X][i] == 0)
      tmp = 0;
    else {
      tmp++;
      ans = max(tmp, ans);
    }
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int tt;
  cin >> n >> m >> q;
  for (int i = (0); i <= (n - 1); i++) {
    for (int j = (0); j <= (m - 1); j++) cin >> maps[i][j];
    rec[i] = js(i);
    maa = max(maa, rec[i]);
  }
  for (int k = (0); k <= (q - 1); k++) {
    cin >> x >> y;
    maps[x - 1][y - 1] = 1 - maps[x - 1][y - 1];
    rec[x - 1] = js(x - 1);
    if (rec[x - 1] >= maa) {
      maa = rec[x - 1];
    } else {
      maa = 0;
      for (int p = (0); p <= (n - 1); p++) maa = maa > rec[p] ? maa : rec[p];
    }
    cout << maa << endl;
  }
  return 0;
}
