#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  vector<vector<int>> v;
  vector<int> t;
  for (int i = 0; i < m; i++) t.push_back(0);
  for (int i = 0; i < n; i++) v.push_back(t);
  int x;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> x;
      v[i][j] = x;
    }
  }
  t.clear();
  int mx, count;
  for (int i = 0; i < n; i++) {
    mx = 0;
    count = 0;
    for (int j = 0; j < m; j++) {
      if (v[i][j] == 1)
        count++;
      else {
        mx = max(mx, count);
        count = 0;
      }
    }
    mx = max(mx, count);
    t.push_back(mx);
  }
  int y;
  for (int i = 0; i < q; i++) {
    cin >> x >> y;
    x--;
    y--;
    v[x][y] = 1 - v[x][y];
    mx = 0;
    count = 0;
    for (int j = 0; j < m; j++) {
      if (v[x][j] == 1)
        count++;
      else {
        mx = max(mx, count);
        count = 0;
      }
    }
    mx = max(mx, count);
    t[x] = mx;
    mx = 0;
    for (int j = 0; j < n; j++) {
      if (t[j] > mx) {
        mx = t[j];
      }
    }
    cout << mx << endl;
  }
  return 0;
}
