#include <bits/stdc++.h>
using namespace std;
int n, m, q, r, c;
const int N = 1000;
int grid[N][N];
int rows[N];
void cal(int i) {
  int cnt = 0;
  rows[i] = 0;
  for (int j = 0; j <= m; ++j) {
    if (grid[i][j])
      cnt++;
    else {
      rows[i] = max(cnt, rows[i]);
      cnt = 0;
    }
  }
}
int main() {
  cin >> n >> m >> q;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> grid[i][j];
      cal(i);
    }
  }
  while (q--) {
    cin >> r >> c;
    r--;
    c--;
    grid[r][c] ^= 1;
    cal(r);
    int fans = 0;
    for (int i = 0; i < n; ++i) fans = max(fans, rows[i]);
    cout << fans << endl;
  }
  return 0;
}
