#include <bits/stdc++.h>
using namespace std;
int main() {
  int grid[505][505];
  int i, j, q, max, tmax = 0;
  int rsum[505];
  int a, b;
  int n, m, count;
  cin >> n >> m >> q;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) cin >> grid[i][j];
  }
  for (i = 0; i < n; i++) {
    max = 0;
    int count = 0;
    for (j = 0; j < m; j++) {
      if (grid[i][j] == 1)
        count++;
      else {
        if (count > max) max = count;
        count = 0;
      }
    }
    if (count > max) max = count;
    rsum[i] = max;
    if (max > tmax) tmax = max;
  }
  for (i = 0; i < q; i++) {
    cin >> a >> b;
    if (grid[a - 1][b - 1] == 1)
      grid[a - 1][b - 1] = 0;
    else
      grid[a - 1][b - 1] = 1;
    int tmp = a - 1, prev = rsum[a - 1];
    max = 0;
    count = 0;
    for (j = 0; j < m; j++) {
      if (grid[tmp][j] == 1)
        count++;
      else {
        if (count > max) max = count;
        count = 0;
      }
    }
    if (count > max) max = count;
    rsum[a - 1] = max;
    if (max >= tmax)
      tmax = max;
    else if (prev == tmax) {
      tmax = 0;
      for (j = 0; j < n; j++)
        if (rsum[j] > tmax) tmax = rsum[j];
    }
    cout << tmax << endl;
  }
  return 0;
}
