#include <bits/stdc++.h>
using namespace std;
int ara[501][501];
int row[501];
int n, m;
int cal(int r) {
  int ct = 0, mx = 0;
  for (int j = 0; j < m; j++) {
    if (ara[r][j] == 0) {
      mx = max(mx, ct);
      ct = 0;
    } else
      ct++;
  }
  mx = max(mx, ct);
  return row[r] = mx;
}
int highest() {
  int mx = 0;
  for (int i = 0; i < n; i++) mx = max(mx, row[i]);
  return mx;
}
int main() {
  int q;
  cin >> n >> m >> q;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> ara[i][j];
    }
  }
  for (int i = 0; i < n; i++) cal(i);
  for (int i = 0; i < q; i++) {
    int a, b;
    cin >> a >> b;
    ara[a - 1][b - 1] = (ara[a - 1][b - 1] + 1) % 2;
    cal(a - 1);
    cout << highest() << "\n";
  }
}
