#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n, m, q;
  cin >> n >> m >> q;
  int s[n][m];
  int a[n];
  int yy;
  for (int i = 0; i < n; i++) {
    yy = 0;
    a[i] = 0;
    for (int o = 0; o < m; o++) {
      cin >> s[i][o];
      if (s[i][o] == 1) {
        yy++;
      }
      if (s[i][o] == 0) {
        a[i] = max(a[i], yy);
        yy = 0;
      }
    }
    a[i] = max(a[i], yy);
  }
  int x, y;
  for (int i = 0; i < q; i++) {
    cin >> x >> y;
    x--;
    y--;
    if (s[x][y] == 1) {
      s[x][y] = 0;
    } else {
      if (s[x][y] == 0) {
        s[x][y] = 1;
      }
    }
    int xx = 0;
    a[x] = 0;
    for (int o = 0; o < m; o++) {
      if (s[x][o] == 0) {
        a[x] = max(a[x], xx);
        xx = 0;
      } else {
        xx++;
      }
    }
    a[x] = max(a[x], xx);
    int ma = 0;
    for (int o = 0; o < n; o++) {
      ma = max(ma, a[o]);
    }
    cout << ma << endl;
  }
}
