#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int main() {
  int n, m, q, i, j, x, y, r;
  int a[501][501];
  cin >> n >> m >> q;
  for (i = 1; i <= n; i = i + 1)
    for (j = 1; j <= m; j = j + 1) cin >> a[i][j];
  int maxim = 0, cnt = 0;
  for (i = 1; i <= n; i = i + 1) {
    for (j = 1; j <= m; j = j + 1) {
      if (a[i][j] == 1) cnt = cnt + 1;
      if (a[i][j] == 0) {
        if (cnt > maxim) {
          maxim = cnt;
          r = i;
        }
        cnt = 0;
      }
    }
    if (cnt > maxim) {
      maxim = cnt;
      r = i;
    }
    cnt = 0;
  }
  for (int k = 1; k <= q; k = k + 1) {
    cin >> x >> y;
    if (a[x][y] == 1)
      a[x][y] = 0;
    else
      a[x][y] = 1;
    if (x != r) {
      for (j = 1; j <= m; j = j + 1) {
        if (a[x][j] == 1) cnt = cnt + 1;
        if (a[x][j] == 0) {
          if (cnt > maxim) {
            maxim = cnt;
            r = x;
          }
          cnt = 0;
        }
      }
      if (cnt > maxim) {
        maxim = cnt;
        r = x;
      }
      cnt = 0;
    } else {
      maxim = 0;
      for (i = 1; i <= n; i = i + 1) {
        for (j = 1; j <= m; j = j + 1) {
          if (a[i][j] == 1) cnt = cnt + 1;
          if (a[i][j] == 0) {
            if (cnt > maxim) {
              maxim = cnt;
              r = i;
            }
            cnt = 0;
          }
        }
        if (cnt > maxim) {
          maxim = cnt;
          r = i;
        }
        cnt = 0;
      }
    }
    v.push_back(maxim);
  }
  for (i = 0; i < v.size(); i = i + 1) cout << v[i] << endl;
  return 0;
}
