#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, q, x, y, mx = 0, ct1 = 0;
  cin >> n >> m >> q;
  int a[n][m];
  int max[m];
  for (int i = 0; i < n; i++) {
    ct1 = 0;
    mx = 0;
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
    for (int l = 0; l < m; l++) {
      if (a[i][l]) {
        ct1++;
      } else {
        ct1 = 0;
      }
      if (mx < ct1) mx = ct1;
    }
    max[i] = mx;
  }
  for (int i = 0; i < q; i++) {
    int ct = 0;
    mx = 0;
    cin >> x >> y;
    (a[x - 1][y - 1] == 1) ? a[x - 1][y - 1] = 0 : a[x - 1][y - 1] = 1;
    ct = 0;
    for (int c = 0; c < m; c++) {
      if (a[x - 1][c]) {
        ct++;
      } else {
        ct = 0;
      }
      if (mx < ct) mx = ct;
    }
    max[x - 1] = mx;
    for (int l = 0; l < n; l++) {
      if (mx < max[l]) {
        mx = max[l];
      }
    }
    cout << mx << endl;
  }
}
