#include <bits/stdc++.h>
using namespace std;
static int n, m, q, x, y;
static int s[510][510];
static int hashs[510];
int rowScore(int r) {
  int sum = 0;
  for (int j = 0; j < m;) {
    int k = j + 1;
    while (k < m && s[r][k] == s[r][j] && s[r][j] == 1) ++k;
    if (s[r][j] == 1)
      sum = max(sum, k - j);
    else
      sum = max(sum, 0);
    j = k;
  }
  return sum;
}
int main() {
  while (scanf("%d%d%d", &n, &m, &q) != EOF) {
    for (int i = 0; i < n; i++)
      for (int j = 0; j < m; j++) scanf("%d", &s[i][j]);
    for (int i = 0; i < n; i++) hashs[i] = rowScore(i);
    for (int i = 0; i < q; i++) {
      scanf("%d%d", &x, &y);
      s[x - 1][y - 1] = !s[x - 1][y - 1];
      hashs[x - 1] = rowScore(x - 1);
      int ans = INT_MIN;
      for (int i = 0; i < n; i++) ans = max(ans, hashs[i]);
      printf("%d\n", ans);
    }
  }
  return 0;
}
