#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int main() {
  ios_base::sync_with_stdio(false);
  int n, m, q;
  cin >> n >> m >> q;
  vector<vector<int> > grid(n, vector<int>(m));
  vector<int> rows(n);
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n))) {
    int cur = 0;
    for (__typeof(m) j = (0) - ((0) > (m)); j != (m) - ((0) > (m));
         j += 1 - 2 * ((0) > (m))) {
      cin >> grid[i][j];
      if (grid[i][j] == 0)
        cur = 0;
      else
        cur++;
      rows[i] = max(cur, rows[i]);
    }
  }
  int i, j;
  while (q--) {
    cin >> i >> j;
    i--;
    j--;
    grid[i][j] ^= 1;
    rows[i] = 0;
    int cur = 0;
    for (__typeof(grid[i].size()) k = (0) - ((0) > (grid[i].size()));
         k != (grid[i].size()) - ((0) > (grid[i].size()));
         k += 1 - 2 * ((0) > (grid[i].size()))) {
      if (grid[i][k] == 0)
        cur = 0;
      else
        cur++;
      rows[i] = max(rows[i], cur);
    }
    cout << *max_element(rows.begin(), rows.end()) << endl;
  }
  return 0;
}
