#include <bits/stdc++.h>
using namespace std;
const int maxn = 2079;
int n, m, k;
vector<vector<int> > up(maxn, vector<int>(maxn, -1)),
    dw(maxn, vector<int>(maxn, -1));
void add(deque<pair<int, int> >& q, pair<int, int> e) {
  while (!q.empty() && q.back().first >= e.first) q.pop_back();
  q.push_back(e);
}
bool check_square(int len, int x) {
  deque<pair<int, int> > qu, qd;
  for (int i = 0; i < m; i++) {
    add(qu, {up[x][i], i});
    add(qd, {dw[x][i], i});
    if (i >= len - 1) {
      int len2 = qu.front().first + qd.front().first - 1;
      if (len2 >= len) return true;
      if (qu.front().second == i - len + 1) qu.pop_front();
      if (qd.front().second == i - len + 1) qd.pop_front();
    }
  }
  return false;
}
vector<string> v(maxn);
void calculate_up_down(int col) {
  for (int i = 0; i < n; i++) {
    if (v[i][col] == 'X')
      up[i][col] = 0;
    else
      up[i][col] = (i ? up[i - 1][col] + 1 : 1);
  }
  for (int i = n - 1; i >= 0; i--) {
    if (v[i][col] == 'X')
      dw[i][col] = 0;
    else
      dw[i][col] = (i < n - 1 ? dw[i + 1][col] + 1 : 1);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) cin >> v[i];
  vector<int> x(k), y(k);
  for (int i = 0; i < k; i++) {
    cin >> x[i] >> y[i];
    v[--x[i]][--y[i]] = 'X';
  }
  for (int i = 0; i < m; i++) calculate_up_down(i);
  vector<int> res(k);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    while (check_square(ans + 1, i)) ans++;
  }
  for (int i = k - 1; i >= 0; i--) {
    res[i] = ans;
    v[x[i]][y[i]] = '.';
    calculate_up_down(y[i]);
    while (ans < n && check_square(ans + 1, x[i])) ans++;
  }
  for (int i = 0; i < k; i++) cout << res[i] << "\n";
  return 0;
}
