#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k, aa, b;
  cin >> n >> m >> k;
  int arr[n][m];
  int a[n];
  for (int i = 0; i < n; i++) {
    int c = 0, ma = 0;
    for (int j = 0; j < m; j++) {
      cin >> arr[i][j];
      if (arr[i][j] == 1) {
        c++;
      } else {
        ma = max(ma, c);
        c = 0;
      }
    }
    ma = max(ma, c);
    a[i] = ma;
  }
  for (int i = 0; i < k; i++) {
    cin >> aa >> b;
    arr[aa - 1][b - 1] = 1 - arr[aa - 1][b - 1];
    int c = 0, ma = 0;
    for (int j = 0; j < m; j++) {
      if (arr[aa - 1][j] == 1) {
        c++;
      } else {
        ma = max(ma, c);
        c = 0;
      }
    }
    ma = max(ma, c);
    a[aa - 1] = ma;
    cout << *max_element(a, a + n) << endl;
  }
}
