#include <bits/stdc++.h>
using namespace std;
int N, M, Q, x, y, part, ans;
int A[500 + 10][500 + 10];
int B[500 + 10];
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", &A[i][j]);
  for (int i = 1; i <= N; i++) {
    part = 0;
    for (int j = 1; j <= M; j++) {
      part = (A[i][j] == 0) ? 0 : part + 1;
      B[i] = max(B[i], part);
    }
  }
  for (int i = 0; i < Q; i++) {
    scanf("%d%d", &x, &y);
    A[x][y] = 1 - A[x][y];
    part = B[x] = 0;
    for (int j = 1; j <= M; j++) {
      part = (A[x][j] == 0) ? 0 : part + 1;
      B[x] = max(B[x], part);
    }
    ans = 0;
    for (int j = 1; j <= N; j++) ans = max(ans, B[j]);
    printf("%d\n", ans);
  }
}
