#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9;
const long long INF64 = (long long)1e18;
#pragma comment(linker, "/STACK:16777216")
#pragma warning(disable : 4786)
int fset(int N, int pos) { return N = N | (1 << pos); }
int reset(int N, int pos) { return N = N & ~(1 << pos); }
bool check(int N, int pos) { return (bool)(N & (1 << pos)); }
const int mx = 1 << 29;
int ans, sum, t, n, k, m, mat[505][505], ar[505], a, b;
void f(int id) {
  int ret = 0, ct = 0;
  for (int i = 1; i <= m; i++) {
    if (mat[id][i] == 0)
      ct = 0;
    else {
      ct++;
      ret = max(ret, ct);
    }
  }
  ar[id] = ret;
}
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%d", &mat[i][j]);
  for (int i = 1; i <= n; i++) {
    f(i);
    ans = max(ans, ar[i]);
  }
  for (int i = 1; i <= k; i++) {
    scanf("%d", &a);
    scanf("%d", &b);
    mat[a][b] = (mat[a][b] + 1) % 2;
    f(a);
    ans = 0;
    for (int j = 1; j <= n; j++) ans = max(ans, ar[j]);
    cout << ans << endl;
  }
  return 0;
}
