#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, q, i, j, k, l = 0, d = 0, t, b;
  bool a[500][500];
  int c[500];
  cin >> n >> m >> q;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  for (i = 0; i < n; i++) {
    k = l = 0;
    for (j = 0; j < m - 1; j++) {
      if (a[i][j] & a[i][j + 1] == 1) {
        l++;
        if (l > k) {
          k = l;
        }
      } else {
        l = 0;
      }
    }
    k++;
    if (k == 1) {
      for (j = 0; j < m - 1; j++) {
        if (a[i][j] == 1) {
          k = 1;
          break;
        }
        k = 0;
      }
    }
    c[i] = k;
  }
  for (b = 0; b < q; b++) {
    cin >> i >> j;
    (a[i - 1][j - 1]) ^= 1;
    t = i - 1;
    k = l = 0;
    for (int j = 0; j < m - 1; j++) {
      if (a[t][j] & a[t][j + 1] == 1) {
        l++;
        if (l > k) {
          k = l;
        }
      } else {
        l = 0;
      }
    }
    k++;
    if (k == 1) {
      for (j = 0; j < m; j++) {
        if (a[t][j] == 1) {
          k = 1;
          break;
        }
        k = 0;
      }
    }
    c[t] = k;
    k = 0;
    for (i = 0; i < n; i++) {
      if (c[i] > k) {
        k = c[i];
      }
    }
    cout << k << '\n';
  }
}
