#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
long long _sieve_size;
bitset<10000010> bs;
vector<int> primes;
void sieve(long long upperbound) {
  _sieve_size = upperbound + 1;
  bs.set();
  for (long long i = 2; i <= _sieve_size; i++)
    if (bs[i]) {
      for (long long j = i * i; j <= _sieve_size; j += i) bs[j] = 0;
      primes.push_back((int)i);
    }
}
bool isPrime(long long N) {
  if (N <= _sieve_size) return bs[N];
  for (int i = 0; i < (int)primes.size(); i++)
    if (N % primes[i] == 0) return false;
  return true;
}
int primeFac(long long a) {
  long long b = a, copy = 1, j = 0;
  for (int i = 2; i <= a; i++) {
    if (!(a % i)) {
      int c = 0;
      while (!(a % i)) {
        a /= i;
        c++;
      }
      j = i;
      copy *= pow(i, c);
      if (copy == b) {
        break;
      }
    }
  }
  return j;
}
bool ar[505][505];
int n, m, q, x, y, mx, c, ans;
int main() {
  {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  };
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> ar[i][j];
    }
  }
  while (q--) {
    cin >> x >> y;
    mx = 0;
    c = 0;
    ar[x][y] = 1 - ar[x][y];
    ans = 0;
    for (int i = 1; i <= n; i++) {
      c = 0, mx = 0;
      for (int j = 1; j <= m; j++) {
        if (ar[i][j])
          c++;
        else
          c = 0;
        mx = max(mx, c);
      }
      ans = max(mx, ans);
    }
    cout << ans << endl;
  }
}
