#include <bits/stdc++.h>
using namespace std;
int n, m, k, ans[2010];
bool mat[2010][2010];
int X[2010], Y[2010];
int f[2010][2010];
struct Ufs {
  int fa[2010];
  Ufs() {
    for (int i = 1; i < 2010; i++) fa[i] = i;
  }
  int getfa(int x) { return x == fa[x] ? x : fa[x] = getfa(fa[x]); }
} l[2010], r[2010];
int gl[2010], gr[2010];
char s[2010];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%s", s + 1);
    for (int j = 1; j <= m; j++) mat[i][j] = s[j] == 'X';
  }
  for (int i = 1; i <= k; i++) scanf("%d%d", &X[i], &Y[i]), mat[X[i]][Y[i]] = 1;
  int cur = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++)
      if (!mat[i][j]) {
        l[i].fa[j] = j - 1;
        r[i].fa[j] = j + 1;
        f[i][j] = min(f[i - 1][j - 1], min(f[i][j - 1], f[i - 1][j])) + 1;
        cur = max(cur, f[i][j]);
      }
  }
  for (int i = k; i; i--) {
    ans[i] = cur;
    int x = X[i], y = Y[i];
    mat[x][y] = 0;
    gl[x] = l[x].fa[y] = l[x].getfa(y - 1);
    gr[x] = r[x].fa[y] = r[x].getfa(y + 1);
    for (int j = x - 1; j; j--) {
      gl[j] = max(gl[j + 1], l[j].getfa(y));
      gr[j] = min(gr[j + 1], r[j].getfa(y));
    }
    for (int j = x + 1; j <= n; j++) {
      gl[j] = max(gl[j - 1], l[j].getfa(y));
      gr[j] = min(gr[j - 1], r[j].getfa(y));
    }
    for (int j = 1; j <= x; j++)
      while (j + cur <= n &&
             min(gr[j], gr[j + cur]) - max(gl[j], gl[j + cur]) - 1 > cur)
        cur++;
  }
  for (int i = 1; i <= k; i++) printf("%d\n", ans[i]);
  return 0;
}
