#include <bits/stdc++.h>
using namespace std;
int a[503][503];
int max_row[503];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m, q, i, j, mxi, cnt, x, y;
  cin >> n >> m >> q;
  for (i = 1; i <= n; i++) {
    mxi = 0, cnt = 0;
    for (j = 1; j <= m; j++) {
      cin >> a[i][j];
      if (a[i][j])
        cnt++;
      else
        cnt = 0;
      mxi = ((mxi > cnt) ? mxi : cnt);
    }
    max_row[i] = mxi;
  }
  for (i = 0; i < q; i++) {
    cin >> x >> y;
    a[x][y] ^= 1;
    cnt = 0, mxi = 0;
    for (j = 1; j <= m; j++) {
      if (a[x][j])
        cnt++;
      else
        cnt = 0;
      mxi = ((mxi > cnt) ? mxi : cnt);
    }
    max_row[x] = mxi;
    mxi = 0;
    for (j = 1; j <= n; j++) mxi = ((mxi > max_row[j]) ? mxi : max_row[j]);
    cout << mxi << endl;
  }
}
