#include <bits/stdc++.h>
using namespace std;
int solve(const vector<int> &row) {
  int n = row.size();
  int res = 0;
  int i = 0;
  while (i < n) {
    if (row[i] == 1) {
      int ni = i;
      while (ni + 1 < n && row[ni + 1] == 1) {
        ni++;
      }
      res = max(res, ni - i + 1);
      i = ni + 1;
    } else {
      i++;
    }
  }
  return res;
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  int n, m, q;
  cin >> n >> m >> q;
  vector<vector<int> > a(n, vector<int>(m));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  vector<int> ans(n, 0);
  for (int i = 0; i < n; i++) {
    ans[i] = solve(a[i]);
  }
  while (q--) {
    int r, c;
    cin >> r >> c;
    r--;
    c--;
    a[r][c] ^= 1;
    ans[r] = solve(a[r]);
    cout << *max_element(begin(ans), end(ans)) << '\n';
  }
  return 0;
}
