#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  int mat[n][m];
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) cin >> mat[i][j];
  int ans[n], temp = 0;
  for (int i = 0; i < n; ++i) ans[i] = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (mat[i][j] == 1)
        ++temp;
      else {
        ans[i] = max(temp, ans[i]);
        temp = 0;
      }
    }
    ans[i] = max(temp, ans[i]);
    temp = 0;
  }
  int x, y;
  for (int i = 0; i < q; ++i) {
    cin >> x >> y;
    --x;
    --y;
    mat[x][y] = (!mat[x][y]);
    ans[x] = 0;
    for (int j = 0; j < m; ++j) {
      if (mat[x][j] == 1)
        ++temp;
      else {
        ans[x] = max(temp, ans[x]);
        temp = 0;
      }
    }
    ans[x] = max(temp, ans[x]);
    temp = 0;
    int a = ans[0];
    for (int j = 1; j < n; ++j) a = max(a, ans[j]);
    cout << a << endl;
  }
  return 0;
}
