#include <bits/stdc++.h>
using namespace std;
int n, m, q, maximo;
int grid[500][500];
int row[500], cnt;
void read() {
  cin >> n >> m >> q;
  for (int i = 0; i < n; i++) {
    int j = 0;
    for (; j < m; j++) {
      cin >> grid[i][j];
    }
    maximo = j = 0;
    while (j < m) {
      cnt = 0;
      while (grid[i][j]) cnt++, j++;
      maximo = max(maximo, cnt);
      row[i] = maximo;
      while (!grid[i][j]) j++;
    }
  }
}
void solve() {
  int i, j;
  while (q--) {
    cin >> i >> j;
    i--, j--;
    grid[i][j] = (grid[i][j]) ? 0 : 1;
    maximo = j = 0;
    while (j < m) {
      cnt = 0;
      while (grid[i][j]) cnt++, j++;
      maximo = max(maximo, cnt);
      row[i] = maximo;
      while (!grid[i][j]) j++;
    }
    for (int i = 0; i < n; i++) maximo = max(maximo, row[i]);
    cout << maximo << endl;
  }
}
int main() {
  read();
  solve();
}
