#include <bits/stdc++.h>
using namespace std;
int rbq[505][505];
int score[505];
int main() {
  int n, m, q;
  while (~scanf("%d%d%d", &n, &m, &q)) {
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        scanf("%d", &rbq[i][j]);
      }
    }
    for (int i = 1; i <= n; i++) {
      int max = 0;
      for (int j = 1; j <= m; j++) {
        int count = 0;
        while (j <= m && rbq[i][j] == 1) {
          j++;
          count++;
        }
        if (count > max) max = count;
      }
      score[i] = max;
    }
    for (int i = 0; i < q; i++) {
      int r, l;
      scanf("%d%d", &r, &l);
      if (rbq[r][l] == 0)
        rbq[r][l] = 1;
      else
        rbq[r][l] = 0;
      int max = 0;
      for (int j = 1; j <= m; j++) {
        int count = 0;
        while (j <= m && rbq[r][j] == 1) {
          j++;
          count++;
        }
        if (count > max) max = count;
      }
      score[r] = max;
      int max_score = 0;
      for (int j = 1; j <= n; j++) {
        if (score[j] > max_score) max_score = score[j];
      }
      printf("%d\n", max_score);
    }
  }
  return 0;
}
