#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, q, c, d, k;
  scanf("%d%d%d", &n, &m, &q);
  int a[n + 2][m + 2];
  int sum1[n + 2];
  memset(a, 0, sizeof(a));
  memset(sum1, 0, sizeof(sum1));
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%d", &a[i][j]);
  int sum;
  for (int k = 0; k < q; k++) {
    int maxn = 0;
    scanf("%d%d", &c, &d);
    if (a[c][d] == 0)
      a[c][d] = 1;
    else
      a[c][d] = 0;
    for (int i = 1; i <= n; i++) {
      int maxn = 0, sum = 0;
      for (int j = 1; j <= m; j++) {
        if (a[i][j] == 1)
          sum += 1;
        else
          sum = 0;
        maxn = max(sum, maxn);
      }
      sum1[i] = maxn;
    }
    for (int j = 1; j <= n; j++) maxn = max(sum1[j], maxn);
    printf("%d\n", maxn);
  }
}
