#include <bits/stdc++.h>
using namespace std;
int mp[505][505], f[505];
void push(int n) {
  for (int i = 1; i <= n; i++) cout << f[i] << " ";
  cout << endl;
}
int main() {
  int n, m, i, j, Q, sum, x, y;
  while (scanf("%d%d%d", &n, &m, &Q) != EOF) {
    memset(f, 0, sizeof(f));
    for (i = 1; i <= n; i++)
      for (j = 1; j <= m; j++) scanf("%d", &mp[i][j]);
    int ans = 0, maxn = 0, sum = 0;
    for (i = 1; i <= n; i++) {
      sum = 0;
      maxn = 0;
      for (j = 1; j <= m; j++) {
        if (mp[i][j] == 1)
          sum++;
        else {
          maxn = max(maxn, sum);
          sum = 0;
        }
      }
      f[i] = max(maxn, sum);
    }
    while (Q--) {
      scanf("%d%d", &x, &y);
      if (mp[x][y] == 0)
        mp[x][y] = 1;
      else
        mp[x][y] = 0;
      maxn = 0, sum = 0;
      for (j = 1; j <= m; j++) {
        if (mp[x][j] == 1)
          sum++;
        else {
          maxn = max(maxn, sum);
          sum = 0;
        }
      }
      maxn = max(maxn, sum);
      f[x] = maxn;
      for (i = 1; i <= n; i++) maxn = max(maxn, f[i]);
      ans = maxn;
      printf("%d\n", ans);
    }
  }
  return 0;
}
