#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
bool grid[1000][1000];
int pref[1000][1000];
multiset<int> ms;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 1; i <= (int)(n); ++i) {
    for (int j = 1; j <= (int)(m); ++j) {
      cin >> grid[i][j];
      if (grid[i][j]) {
        pref[i][j] = pref[i][j - 1] + 1;
      }
    }
    for (int j = 1; j <= (int)(m); ++j) {
      if (pref[i][j] != 0 && pref[i][j + 1] == 0) {
        ms.insert(pref[i][j]);
      }
    }
  }
  for (int i = 0; i < (int)(q); ++i) {
    int x, y;
    cin >> x >> y;
    for (int j = 1; j <= (int)(m); ++j) {
      if (pref[x][j] != 0 && pref[x][j + 1] == 0) {
        ms.erase(ms.find(pref[x][j]));
      }
    }
    grid[x][y] ^= 1;
    memset(pref[x], 0, sizeof pref[x]);
    for (int j = 1; j <= (int)(m); ++j) {
      if (grid[x][j]) {
        pref[x][j] = pref[x][j - 1] + 1;
      }
    }
    for (int j = 1; j <= (int)(m); ++j) {
      if (pref[x][j] != 0 && pref[x][j + 1] == 0) {
        ms.insert(pref[x][j]);
      }
    }
    if (ms.size() > 0)
      cout << *ms.rbegin() << '\n';
    else
      cout << 0 << '\n';
  }
  return 0;
}
