#include <bits/stdc++.h>
using namespace std;
int n, m, q, a, b, mx;
int v[509][509], row[509];
int main() {
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++) {
    int j = 0, k = 0;
    for (int h = 1; h <= m; h++)
      cin >> v[i][h], k = (v[i][h] == 1 ? k + 1 : 0), j = max(j, k);
    row[i] = j;
  }
  while (q--) {
    cin >> a >> b;
    v[a][b] = 1 - v[a][b];
    int j = 0, k = 0;
    for (int i = 1; i <= m; i++) k = (v[a][i] == 1 ? k + 1 : 0), j = max(j, k);
    row[a] = j;
    j = 0;
    for (int i = 1; i <= n; i++) j = max(j, row[i]);
    cout << j << "\n";
  }
}
