#include <bits/stdc++.h>
using namespace std;
int n, m, q;
int A[501][501], B[501];
int main() {
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> A[i][j];
  for (int i = 1; i <= n; i++) {
    int c = 0;
    for (int j = 1; j <= m; j++) {
      if (A[i][j] == 1)
        c++;
      else if (A[i][j] == 0) {
        B[i] = max(B[i], c);
        c = 0;
      }
    }
    B[i] = max(B[i], c);
  }
  int x, y;
  for (int i = 0; i < q; i++) {
    cin >> x >> y;
    if (A[x][y] == 0)
      A[x][y] = 1;
    else if (A[x][y] == 1)
      A[x][y] = 0;
    int c = 0;
    B[x] = 0;
    for (int j = 1; j <= m; j++) {
      if (A[x][j] == 1)
        c++;
      else
        B[x] = max(B[x], c), c = 0;
    }
    B[x] = max(B[x], c);
    int mx = -1;
    for (int j = 1; j <= n; j++) mx = max(mx, B[j]);
    cout << mx << endl;
  }
  return 0;
}
