#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, l, m, n, q;
  cin >> n >> m >> q;
  int arr[n][m];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> arr[i][j];
    }
  }
  int max = 0, row = 0;
  for (int i = 0; i < n; i++) {
    int _max = 0;
    if (arr[i][0] == 1) _max++;
    int asd = 0;
    if (arr[i][0] == 1) asd++;
    for (int j = 1; j < m; j++) {
      if (arr[i][j] == 0) asd = 0;
      if (arr[i][j] == 1) {
        asd++;
        if (asd > _max) _max = asd;
      }
    }
    if (_max > max) {
      max = _max;
      row = i;
    }
  }
  while (q--) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    if (arr[x][y] == 0) {
      arr[x][y] = 1;
    } else
      arr[x][y] = 0;
    if (row == x) {
      max = 0;
      for (int i = 0; i < n; i++) {
        int _max = 0;
        if (arr[i][0] == 1) _max++;
        int asd = 0;
        if (arr[i][0] == 1) asd++;
        for (int j = 1; j < m; j++) {
          if (arr[i][j] == 0) asd = 0;
          if (arr[i][j] == 1) {
            asd++;
            if (asd > _max) _max = asd;
          }
        }
        if (_max > max) {
          max = _max;
          row = i;
        }
      }
    } else {
      int _max = 0;
      if (arr[x][0] == 1) _max++;
      int asd = 0;
      if (arr[x][0] == 1) asd++;
      for (int j = 1; j < m; j++) {
        if (arr[x][j] == 0) asd = 0;
        if (arr[x][j] == 1) {
          asd++;
          if (asd > _max) _max = asd;
        }
      }
      if (_max > max) {
        max = _max;
        row = x;
      }
    }
    cout << max << endl;
  }
}
