#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2010;
int n, m, k, a[MAXN], b[MAXN], up[MAXN][MAXN], down[MAXN][MAXN], dp[MAXN][MAXN];
struct monotoni_queue {
  deque<pair<int, int> > q;
  void ubaci(int x, int y, int t) {
    while (!q.empty() && q.back().first >= x) q.pop_back();
    while (!q.empty() && q.front().second + t < y + 1) q.pop_front();
    q.push_back(make_pair(x, y));
  }
  int get() { return q.front().first; }
  void clear() { q.clear(); }
};
monotoni_queue gore, dole;
char s[MAXN][MAXN];
int sol;
void oslobodi(int x, int y) {
  s[x][y] = '.';
  for (int i = (0); i < int(n); i++)
    up[i][y] = (!i || s[i - 1][y] == 'X') ? 0 : up[i - 1][y] + 1;
  for (int i = n - 1; i >= 0; i--)
    down[i][y] = (i == n - 1 || s[i + 1][y] == 'X') ? 0 : down[i + 1][y] + 1;
}
int solve(int x) {
  int ret = 0, last = 0;
  dole.clear();
  gore.clear();
  for (int i = (0); i < int(m); i++) {
    ;
    if (s[x][i] == 'X') {
      gore.clear();
      dole.clear();
      last = i + 1;
      continue;
    }
    gore.ubaci(up[x][i], i, sol + 1);
    dole.ubaci(down[x][i], i, sol + 1);
    if (i < sol + last) continue;
    int a = gore.get();
    int b = dole.get();
    ;
    ;
    ret = max(ret, min(a + b + 1, sol + 1));
  };
  return ret;
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = (0); i < int(n); i++) scanf("%s", s[i]);
  for (int i = (0); i < int(k); i++) {
    scanf("%d %d", &a[i], &b[i]);
    a[i]--;
    b[i]--;
    s[a[i]][b[i]] = 'X';
  }
  for (int i = (0); i < int(n); i++) {
    for (int j = (0); j < int(m); j++) {
      if (s[i][j] == 'X') {
        dp[i][j] = 0;
        continue;
      }
      if (!i || !j) {
        dp[i][j] = 1;
        continue;
      }
      dp[i][j] = min(dp[i - 1][j], min(dp[i][j - 1], dp[i - 1][j - 1])) + 1;
    }
  }
  for (int i = (0); i < int(n); i++)
    for (int j = (0); j < int(m); j++) sol = max(sol, dp[i][j]);
  for (int i = (0); i < int(n); i++)
    for (int j = (0); j < int(m); j++)
      up[i][j] = (!i || s[i - 1][j] == 'X') ? 0 : up[i - 1][j] + 1;
  for (int i = n - 1; i >= 0; i--)
    for (int j = (0); j < int(m); j++)
      down[i][j] = (i == n - 1 || s[i + 1][j] == 'X') ? 0 : down[i + 1][j] + 1;
  vector<int> ans;
  for (int i = k - 1; i >= 0; i--) {
    ans.push_back(sol);
    oslobodi(a[i], b[i]);
    int konj = sol;
    sol = max(sol, solve(a[i]));
    while (konj != sol) {
      konj = sol;
      sol = max(sol, solve(a[i]));
    }
  }
  reverse((ans).begin(), (ans).end());
  for (int i = (0); i < int((int)ans.size()); i++) printf("%d\n", ans[i]);
  return 0;
}
