#include <bits/stdc++.h>
using namespace std;
int n, m, q, T[505][505], S[505];
void policz(int nr) {
  int akt = 0;
  S[nr] = 0;
  for (int i = 1; i <= m; i++) {
    if (T[nr][i] == 1)
      akt++;
    else {
      S[nr] = max(S[nr], akt);
      akt = 0;
    }
  }
  S[nr] = max(S[nr], akt);
}
int main() {
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%d", &T[i][j]);
  for (int i = 1; i <= n; i++) policz(i);
  while (q--) {
    int x, y;
    scanf("%d %d", &x, &y);
    if (T[x][y] == 1)
      T[x][y] = 0;
    else
      T[x][y] = 1;
    policz(x);
    int best = 0;
    for (int i = 1; i <= n; i++) best = max(best, S[i]);
    printf("%d\n", best);
  }
  return 0;
}
