#include <bits/stdc++.h>
using namespace std;
int a[501][501], n, m, q, res, score[501];
void quet(int i) {
  int tmp = 0;
  score[i] = 0;
  for (int j = 1; j <= m; j++) {
    if (a[i][j] == 1) tmp = tmp + 1;
    score[i] = max(score[i], tmp);
    if (a[i][j] == 0) tmp = 0;
  }
}
void xulitruoc() {
  for (int i = 1; i <= n; i++) quet(i);
}
void tinhdiem() {
  res = 0;
  for (int i = 1; i <= n; i++) res = max(res, score[i]);
}
int main() {
  int u, v;
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> a[i][j];
  xulitruoc();
  for (int t = 1; t <= q; t++) {
    cin >> u >> v;
    a[u][v] = 1 - a[u][v];
    quet(u);
    tinhdiem();
    cout << res << endl;
  }
  return 0;
}
