#include <bits/stdc++.h>
using namespace std;
vector<int> vec;
int arr[501][501];
int main() {
  int n, m, q, i, j, k, a, b, max, ctr;
  cin >> n >> m >> q;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      cin >> arr[i][j];
    }
  }
  for (i = 0; i < q; i++) {
    cin >> a >> b;
    if (arr[a - 1][b - 1] == 0)
      arr[a - 1][b - 1] = 1;
    else
      arr[a - 1][b - 1] = 0;
    max = 0;
    for (j = 0; j < n; j++) {
      ctr = 0;
      for (k = 0; k < m; k++) {
        if (arr[j][k] == 1) {
          ctr++;
        } else
          ctr = 0;
        if (ctr >= max) max = ctr;
      }
    }
    cout << max << '\n';
  }
}
