#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int mx[600];
int n, m, q;
int A[600][600];
void solve(int i) {
  int cur = 0;
  mx[i] = 0;
  for (int j = 1; j <= m; j++) {
    if (A[i][j]) {
      cur++;
    } else
      cur = 0;
    mx[i] = max(mx[i], cur);
  }
}
int main() {
  cin >> n >> m >> q;
  for (int i = 1; i < n + 1; i++) {
    for (int j = 1; j < m + 1; j++) {
      cin >> A[i][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    solve(i);
  }
  while (q--) {
    int i, j;
    cin >> i >> j;
    A[i][j] = !A[i][j];
    int ans = 0;
    solve(i);
    for (int i = 1; i <= n; i++) {
      ans = max(ans, mx[i]);
    }
    cout << ans << '\n';
  }
  return 0;
}
