#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  int a[n][m], ans[n];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cin >> a[i][j];
    int val = 0, index = 0;
    while (1) {
      if (index >= m) break;
      while (index < m && a[i][index] == 0) {
        index++;
      }
      int cur = 0;
      while (index < m && a[i][index] == 1) {
        index++;
        cur++;
      }
      val = max(val, cur);
    }
    ans[i] = val;
  }
  for (int i = 0; i < q; i++) {
    int r, c;
    cin >> r >> c;
    r--;
    c--;
    a[r][c] = 1 - a[r][c];
    int val = 0, index = 0, found = 0;
    while (index < m) {
      while (index < m && a[r][index] == 0) index++;
      int cur = 0;
      while (index < m && a[r][index] == 1) {
        index++;
        cur++;
      }
      found = max(found, cur);
    }
    ans[r] = found;
    for (int j = 0; j < n; j++) found = max(found, ans[j]);
    cout << found << endl;
  }
  return 0;
}
