#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, q;
  cin >> n >> m >> q;
  long long int d[n + 1][m + 1];
  map<long long int, long long int> mp;
  long long int mx = 0;
  for (long long int i = 1; i <= n; i++) {
    long long int sum = 0, mx = 0;
    for (long long int j = 1; j <= m; j++) {
      cin >> d[i][j];
      if (d[i][j] == 1) {
        sum++;
      } else {
        mx = max(mx, sum);
        sum = 0;
      }
    }
    mx = max(mx, sum);
    mp[i] = mx;
  }
  while (q--) {
    long long int a, b, s, mx1, ans = 0;
    cin >> a >> b;
    if (d[a][b] == 1) {
      d[a][b] = 0;
      s = 0, mx1 = 0;
      for (long long int i = 1; i <= m; i++) {
        if (d[a][i] == 1) {
          s++;
        } else {
          mx1 = max(mx1, s);
          s = 0;
        }
      }
      mx1 = max(mx1, s);
      mp[a] = mx1;
    } else {
      d[a][b] = 1;
      s = 0, mx1 = 0;
      for (long long int i = 1; i <= m; i++) {
        if (d[a][i] == 1) {
          s++;
        } else {
          mx1 = max(mx1, s);
          s = 0;
        }
      }
      mx1 = max(mx1, s);
      mp[a] = mx1;
    }
    for (long long int i = 1; i <= n; i++) {
      ans = max(ans, mp[i]);
    }
    cout << ans << "\n";
    ;
  }
}
