#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)510;
int v[maxn][maxn];
int h[maxn];
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      scanf("%d", &v[i][j]);
    }
  }
  for (int i = 0; i < n; i++) {
    int maxx = 0;
    int now_max = 0;
    for (int j = 0; j < m; j++) {
      if (v[i][j] == 1) {
        now_max++;
      } else {
        maxx = max(now_max, maxx);
        now_max = 0;
      }
    }
    maxx = max(now_max, maxx);
    h[i] = maxx;
  }
  for (int g = 0; g < k; g++) {
    int a, b;
    scanf("%d %d", &a, &b);
    a--;
    b--;
    v[a][b]++;
    v[a][b] %= 2;
    int maxx = 0;
    int now_max = 0;
    for (int j = 0; j < m; j++) {
      if (v[a][j] == 1) {
        now_max++;
      } else {
        maxx = max(now_max, maxx);
        now_max = 0;
      }
    }
    maxx = max(now_max, maxx);
    h[a] = maxx;
    int res = 0;
    for (int j = 0; j < n; j++) {
      res = max(res, h[j]);
    }
    cout << res << endl;
  }
  return 0;
}
