#include <bits/stdc++.h>
using namespace std;
int g[510][510], sum[510];
int n, m, q;
int main() {
  scanf("%d%d%d", &n, &m, &q);
  memset(sum, 0, sizeof(sum));
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) scanf("%d", &g[i][j]);
    int z = 0;
    for (int j = 1; j <= m; ++j)
      if (g[i][j])
        ++z;
      else {
        sum[i] = max(sum[i], z);
        z = 0;
      }
    sum[i] = max(sum[i], z);
  }
  int x, y;
  while (q--) {
    scanf("%d%d", &x, &y);
    g[x][y] ^= 1;
    int z = 0;
    sum[x] = 0;
    for (int i = 1; i <= m; ++i)
      if (g[x][i])
        ++z;
      else {
        sum[x] = max(sum[x], z);
        z = 0;
      }
    sum[x] = max(sum[x], z);
    int ans = 0;
    for (int i = 1; i <= n; ++i) ans = max(ans, sum[i]);
    printf("%d\n", ans);
  }
  return 0;
}
