#include <bits/stdc++.h>
using namespace std;
int grid[505][505] = {0};
int m, n, q;
multiset<int> st;
int find_con(int row) {
  int mx = 0;
  for (int i = 1; i <= m; i++)
    if (grid[row][i]) {
      int t = 0;
      while (grid[row][i] && i <= m) {
        t++;
        i++;
      }
      mx = max(mx, t);
    }
  return mx;
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) scanf("%d", &grid[i][j]);
    st.insert(find_con(i));
  }
  while (q--) {
    int a, b;
    multiset<int>::iterator it;
    scanf("%d%d", &a, &b);
    it = st.find(find_con(a));
    st.erase(it);
    grid[a][b] = !grid[a][b];
    int con = find_con(a);
    st.insert(con);
    printf("%d\n", *st.rbegin());
  }
  return 0;
}
