#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, q, k, l, dem, maxx = 0;
  cin >> n >> m >> q;
  int a[n + 1][m + 1], c[q + 1], b[n + 1];
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cin >> a[i][j];
  }
  for (int i = 1; i <= n; i++) {
    b[i] = 0;
    dem = 0;
    for (int j = 1; j <= m; j++) {
      if (a[i][j] == 1) {
        dem++;
        continue;
      }
      if (a[i][j] == 0) {
        if (dem > maxx) maxx = dem;
        dem = 0;
        continue;
      }
    }
    if (dem > maxx) maxx = dem;
    b[i] = maxx;
    maxx = 0;
  }
  for (int i = 1; i <= q; i++) {
    dem = 0;
    cin >> k >> l;
    if (a[k][l] == 1) {
      a[k][l] = 0;
    } else {
      a[k][l] = 1;
    }
    for (int j = 1; j <= m; j++) {
      if (a[k][j] == 1) {
        dem++;
        continue;
      }
      if (a[k][j] == 0) {
        if (dem > maxx) maxx = dem;
        dem = 0;
        continue;
      }
    }
    if (dem > maxx) maxx = dem;
    b[k] = maxx;
    maxx = 0;
    for (int f = 1; f <= n; f++) {
      if (b[f] > maxx) maxx = b[f];
    }
    c[i] = maxx;
    maxx = 0;
  }
  for (int i = 1; i <= q; i++) cout << c[i] << endl;
}
