#include <bits/stdc++.h>
using namespace std;
const int maxn = 6e2;
int a[maxn][maxn], b[maxn];
int n, m, q;
void gao(int x) {
  int t = 0;
  b[x] = 0;
  for (int i = 1; i <= m + 1; i++) {
    if (a[x][i] == 1) {
      t += 1;
    } else {
      b[x] = max(b[x], t);
      t = 0;
    }
  }
}
int main() {
  if (fopen("input.txt", "r")) {
    freopen("input.txt", "r", stdin);
  }
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cin >> a[i][j];
  }
  for (int i = 1; i <= n; i++) gao(i);
  while (q--) {
    int i, j;
    cin >> i >> j;
    a[i][j] = 1 - a[i][j];
    gao(i);
    cout << *max_element(b + 1, b + n + 1) << endl;
  }
  return 0;
}
