#include <bits/stdc++.h>
using namespace std;
const int N = 2100;
char s[N][N];
struct node {
  int x, y;
  void read() {
    scanf("%d%d", &x, &y);
    s[x][y] = 'X';
  }
} p[N];
int n, m, k, tmp, ml[N], mr[N], ans[N];
int l[N][N], r[N][N], dp[N][N], up[N][N];
int findl(int i, int x) {
  return l[i][x] == x ? x : l[i][x] = findl(i, l[i][x]);
}
int findr(int i, int x) {
  return r[i][x] == x ? x : r[i][x] = findr(i, r[i][x]);
}
void del(int x, int y) {
  l[x][y] = findl(x, y - 1);
  r[x][y] = findr(x, y + 1);
}
int main() {
  int i, j, t;
  scanf("%d%d%d", &n, &m, &k);
  for (i = 1; i <= n; i++) scanf("%s", s[i] + 1);
  for (i = 1; i <= k; i++) p[i].read();
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m + 1; j++) l[i][j] = r[i][j] = j;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++)
      if (s[i][j] == '.') del(i, j), up[i][j] = i;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) {
      if (s[i][j] == '.') {
        up[i][j] = up[i - 1][j];
        dp[i][j] =
            min(min(dp[i - 1][j - 1] + 1, j - findl(i, j)), i - up[i][j]);
        tmp = max(dp[i][j], tmp);
      } else
        up[i][j] = i;
    }
  for (t = k; t; t--) {
    ans[t] = tmp;
    del(p[t].x, p[t].y);
    ml[p[t].x] = p[t].y - findl(p[t].x, p[t].y);
    mr[p[t].x] = findr(p[t].x, p[t].y) - p[t].y;
    for (i = p[t].x - 1; i > 0; i--) {
      ml[i] = min(ml[i + 1], p[t].y - findl(i, p[t].y));
      mr[i] = min(mr[i + 1], findr(i, p[t].y) - p[t].y);
    }
    for (i = p[t].x + 1; i <= n; i++) {
      ml[i] = min(ml[i - 1], p[t].y - findl(i, p[t].y));
      mr[i] = min(mr[i - 1], findr(i, p[t].y) - p[t].y);
    }
    for (i = 1; i <= p[t].x; i++)
      while (i + tmp <= n &&
             min(ml[i], ml[i + tmp]) + min(mr[i], mr[i + tmp]) - 1 > tmp)
        tmp++;
  }
  for (i = 1; i <= k; i++) printf("%d\n", ans[i]);
  return 0;
}
