#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.1415926535897932384626433832795028;
int main() {
  long long n, m;
  cin >> n >> m;
  long long q;
  cin >> q;
  long long a[n + 1][m + 1];
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) cin >> a[i][j];
  }
  long long row[502];
  memset(row, 0, sizeof row);
  for (long long i = 0; i < n; i++) {
    long long cnt = 0;
    for (long long j = 0; j < m; j++) {
      if (a[i][j] == 1)
        cnt++;
      else {
        row[i] = max(row[i], cnt);
        cnt = 0;
      }
    }
    row[i] = max(row[i], cnt);
  }
  while (q--) {
    long long x, y;
    cin >> x >> y;
    x--;
    y--;
    a[x][y] = !a[x][y];
    long long cnt = 0;
    row[x] = 0;
    for (long long i = 0; i < m; i++) {
      if (a[x][i] == 1)
        cnt++;
      else {
        row[x] = max(row[x], cnt);
        cnt = 0;
      }
    }
    row[x] = max(row[x], cnt);
    long long ans = 0;
    for (long long i = 0; i < n; i++) {
      ans = max(ans, row[i]);
    }
    cout << ans << endl;
  }
}
