#include <bits/stdc++.h>
using namespace std;
const int N = 502;
int a[N][N], cnt[N];
int add(int a[], int n) {
  int res = 0;
  int t = 0;
  for (int i = 0; i < n; ++i) {
    if (a[i]) {
      ++t;
    } else {
      res = max(res, t);
      t = 0;
    }
  }
  res = max(res, t);
  return res;
}
int main(void) {
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) {
      cin >> a[i][j];
    }
  for (int i = 0; i < n; ++i) {
    cnt[i] = add(a[i], m);
  }
  for (int i = 0; i < q; ++i) {
    int x, y;
    cin >> x >> y;
    --x, --y;
    a[x][y] ^= 1;
    cnt[x] = add(a[x], m);
    int ans = 0;
    for (int i = 0; i < n; ++i) {
      ans = max(ans, cnt[i]);
    }
    cout << ans << endl;
  }
  return 0;
}
