#include <bits/stdc++.h>
using namespace std;
int g[510][510];
int num[510];
int main() {
  int n, m, q;
  int i, j, k;
  int ans;
  while (cin >> n >> m >> q) {
    memset(g, 0, sizeof(g));
    memset(num, 0, sizeof(num));
    for (i = 1; i <= n; i++) {
      int tmp = 0;
      int t2 = 0;
      for (j = 1; j <= m; j++) {
        scanf("%d", &g[i][j]);
        if (g[i][j] == 0) {
          t2 = t2 > tmp ? t2 : tmp;
          tmp = 0;
        } else if (g[i][j] == 1)
          tmp += g[i][j];
      }
      t2 = t2 > tmp ? t2 : tmp;
      num[i] = t2;
    }
    for (i = 1; i <= q; i++) {
      int a, b;
      cin >> a >> b;
      int tmp1 = 0;
      int t3 = 0;
      if (g[a][b] == 0) {
        g[a][b] = 1;
      } else if (g[a][b] == 1) {
        g[a][b] = 0;
      }
      for (j = 1; j <= m; j++) {
        if (g[a][j] == 0) {
          t3 = t3 > tmp1 ? t3 : tmp1;
          tmp1 = 0;
        } else if (g[a][j] == 1)
          tmp1 += g[a][j];
      }
      t3 = t3 > tmp1 ? t3 : tmp1;
      num[a] = t3;
      ans = 0;
      for (j = 1; j <= n; j++) ans = ans > num[j] ? ans : num[j];
      cout << ans << endl;
    }
  }
  return 0;
}
