#include <bits/stdc++.h>
using namespace std;
int n, m, q, x, y, maxi = 0, buf = 1, max_row[501];
bool arr[501][501];
int main() {
  cin >> n >> m >> q;
  for (int i = 0; i < n; i++) {
    max_row[i] = 0;
    for (int j = 0; j < m; j++) cin >> arr[i][j];
  }
  for (int i = 0; i < n; i++) {
    buf = 0;
    for (int j = 0; j < m; j++) {
      if (arr[i][j] == 1)
        buf++;
      else
        buf = 0;
      max_row[i] = max(max_row[i], buf);
      maxi = max(maxi, max_row[i]);
    }
  }
  for (int i = 0; i < q; i++) {
    cin >> x >> y;
    if (arr[x - 1][y - 1] == 0)
      arr[x - 1][y - 1] = 1;
    else
      arr[x - 1][y - 1] = 0;
    max_row[x - 1] = 0;
    buf = 0;
    for (int j = 0; j < m; j++) {
      if (arr[x - 1][j] == 1)
        buf++;
      else
        buf = 0;
      max_row[x - 1] = max(max_row[x - 1], buf);
    }
    maxi = 0;
    for (int i = 0; i < n; i++) maxi = max(maxi, max_row[i]);
    cout << maxi << endl;
  }
  return 0;
}
