#include <bits/stdc++.h>
using namespace std;
long long BigMod(long long B, long long P, long long M) {
  long long R = 1;
  while (P > 0) {
    if (P % 2 == 1) {
      R = (R * B) % M;
    }
    P /= 2;
    B = (B * B) % M;
  }
  return R;
}
template <class T1>
void deb(T1 e1) {
  cout << e1 << endl;
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << endl;
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << endl;
}
template <class T1, class T2, class T3, class T4>
void deb(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << endl;
}
template <class T1, class T2, class T3, class T4, class T5>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << endl;
}
template <class T1, class T2, class T3, class T4, class T5, class T6>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << " " << e6
       << endl;
}
bool mat[505][505];
int main() {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  int res[505];
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      int v;
      scanf("%d", &v);
      mat[i][j] = v;
    }
    int tres = 0;
    int con = 0;
    for (int j = 1; j <= m; j++) {
      if (mat[i][j])
        con++;
      else {
        tres = max(tres, con);
        con = 0;
      }
    }
    tres = max(tres, con);
    res[i] = tres;
  }
  while (k--) {
    int u, v;
    scanf("%d %d", &u, &v);
    mat[u][v] = !mat[u][v];
    int tres = 0;
    int con = 0;
    for (int j = 1; j <= m; j++) {
      if (mat[u][j])
        con++;
      else {
        tres = max(tres, con);
        con = 0;
      }
    }
    tres = max(tres, con);
    res[u] = tres;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      ans = max(ans, res[i]);
    }
    printf("%d\n", ans);
  }
  return 0;
}
