#include <bits/stdc++.h>
using namespace std;
int n, m, q, a[501][501], x, y, s, ans;
vector<int> v;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> a[i][j];
  for (int p = 1; p <= q; p++) {
    cin >> x >> y;
    if (a[x][y] == 1)
      a[x][y] = 0;
    else
      a[x][y] = 1;
    for (int i = 1; i <= n; i++) {
      s = 0;
      for (int j = 1; j <= m; j++) {
        if (a[i][j] == 1)
          s++;
        else
          s = 0;
        ans = max(ans, s);
      }
    }
    v.push_back(ans);
    ans = 0;
  }
  for (int i = 0; i < v.size(); i++) cout << v[i] << endl;
}
