#include <bits/stdc++.h>
using namespace std;
int max1(vector<int> &row) {
  int m = row.size();
  int max = 0;
  int count1 = 0;
  for (int j = 0; j < m; j++) {
    if (row[j] == 1)
      count1++;
    else {
      max = max < count1 ? count1 : max;
      count1 = 0;
    }
    max = max < count1 ? count1 : max;
  }
  return max;
}
int maxValVector(vector<int> v) {
  int max = v[0];
  for (int i = 1; i < v.size(); i++) max = max < v[i] ? v[i] : max;
  return max;
}
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  vector<vector<int>> table;
  vector<int> ansRows;
  for (int i = 0; i < n; i++) {
    vector<int> row;
    for (int j = 0; j < m; j++) {
      int read;
      cin >> read;
      row.push_back(read);
    }
    table.push_back(row);
    ansRows.push_back(max1(row));
  }
  for (int iter = 0; iter < q; iter++) {
    int i, j;
    cin >> i >> j;
    i--;
    j--;
    table[i][j] = 1 - table[i][j];
    ansRows[i] = max1(table[i]);
    cout << maxValVector(ansRows) << endl;
  }
  return 0;
}
