#include <bits/stdc++.h>
using namespace std;
int n, m, q, sum[505];
int main() {
  int i, j, temp, mt, ans[5003], at = 0, a[505][505];
  cin >> n >> m >> q;
  for (i = 0; i < n; i++) {
    temp = 0;
    mt = 0;
    for (j = 0; j < m; j++) {
      cin >> a[i][j];
      if (a[i][j] == 0) {
        if (mt < temp) mt = temp;
        temp = 0;
      } else
        temp++;
    }
    sum[i] = mt > temp ? mt : temp;
  }
  int t = q;
  while (t--) {
    cin >> i >> j;
    i--;
    j--;
    if (a[i][j] == 0) {
      a[i][j] = 1;
      temp = 0;
      mt = 0;
      for (j = 0; j < m; j++) {
        if (a[i][j] == 0) {
          if (mt < temp) mt = temp;
          temp = 0;
        } else
          temp++;
      }
      sum[i] = mt > temp ? mt : temp;
      int ran = 0;
      for (int k = 0; k < n; k++)
        if (ran < sum[k]) ran = sum[k];
      ans[at++] = ran;
    } else {
      a[i][j] = 0;
      temp = 0;
      mt = 0;
      for (j = 0; j < m; j++) {
        if (a[i][j] == 0) {
          if (mt < temp) mt = temp;
          temp = 0;
        } else
          temp++;
      }
      sum[i] = mt > temp ? mt : temp;
      int ran = 0;
      for (int k = 0; k < n; k++)
        if (ran < sum[k]) ran = sum[k];
      ans[at++] = ran;
    }
  }
  for (i = 0; i < at; i++) cout << ans[i] << endl;
  return 0;
}
