#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e6 + 6;
long long int dp[N][4];
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, m, q;
  cin >> n >> m >> q;
  long long int a[n][m];
  for (long long int i = 0; i < n; ++i)
    for (long long int j = 0; j < m; ++j) cin >> a[i][j];
  vector<long long int> dp(n + 1, 0);
  for (long long int i = 0; i < n; ++i) {
    long long int ans = 0;
    long long int curr = 0;
    for (long long int j = 0; j < m; ++j) {
      if (a[i][j] == 0)
        curr = 0;
      else
        curr = curr + 1;
      ans = max(curr, ans);
    }
    dp[i] = ans;
  }
  while (q--) {
    long long int i, j;
    cin >> i >> j;
    --i, --j;
    a[i][j] = 1 - a[i][j];
    long long int ans = 0, curr = 0;
    for (long long int j = 0; j < m; ++j) {
      if (a[i][j] == 0)
        curr = 0;
      else
        curr = curr + 1;
      ans = max(curr, ans);
    }
    dp[i] = ans;
    ans = 0;
    for (auto i : dp) ans = max(ans, i);
    cout << ans << "\n";
  }
  return 0;
}
