#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2005;
int N, M, Q, ans[MAXN], Ans;
int Up[MAXN][MAXN], Do[MAXN][MAXN];
int Le[MAXN][MAXN], Ri[MAXN][MAXN];
int dp[MAXN][MAXN];
char c[MAXN][MAXN];
int d[MAXN], u[MAXN];
struct Node {
  int x, y;
} s[MAXN];
void Prepare() {
  for (int i = 1; i <= M; i++) Do[N + 1][i] = N + 1;
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= M; j++)
      if (c[i][j] == 'X')
        Up[i][j] = i;
      else
        Up[i][j] = Up[i - 1][j];
  for (int i = N; i >= 1; i--)
    for (int j = M; j >= 1; j--)
      if (c[i][j] == 'X')
        Do[i][j] = i;
      else
        Do[i][j] = Do[i + 1][j];
}
int main() {
  scanf("%d%d%d", &N, &M, &Q);
  for (int i = 1; i <= N; i++) scanf("%s", c[i] + 1);
  for (int i = 1; i <= Q; i++) {
    scanf("%d%d", &s[i].x, &s[i].y);
    c[s[i].x][s[i].y] = 'X';
  }
  Prepare();
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= M; j++)
      if (c[i][j] == '.') {
        dp[i][j] = min(min(dp[i - 1][j], dp[i][j - 1]), dp[i - 1][j - 1]) + 1;
        Ans = max(Ans, dp[i][j]);
      }
  for (int i = Q; i >= 1; i--) {
    c[s[i].x][s[i].y] = '.';
    ans[i] = Ans;
    for (int j = s[i].x; j <= N && c[j][s[i].y] == '.'; j++)
      Up[j][s[i].y] = Up[j - 1][s[i].y];
    for (int j = s[i].x; j >= 1 && c[j][s[i].y] == '.'; j--)
      Do[j][s[i].y] = Do[j + 1][s[i].y];
    while (1) {
      int t = Ans + 1, Ok = 0, b, e;
      int mx = 0, mi = N + 1, l = s[i].y, r = s[i].y;
      for (b = s[i].y; b >= 1 && c[s[i].x][b] == '.'; b--)
        ;
      b++;
      for (e = s[i].y; e <= M && c[s[i].x][e] == '.'; e++)
        ;
      e--;
      d[s[i].y] = N + 1;
      u[s[i].y] = 0;
      for (int j = s[i].y + 1; j <= e; j++) {
        d[j] = min(Do[s[i].x][j], d[j - 1]);
        u[j] = max(Up[s[i].x][j], u[j - 1]);
      }
      for (int l = s[i].y, r = e; l >= b; l--) {
        mi = min(mi, Do[s[i].x][l]);
        mx = max(mx, Up[s[i].x][l]);
        while (r >= s[i].y && r >= l + t - 1 &&
               min(d[r], mi) - max(u[r], mx) - 1 < t)
          r--;
        if (r >= s[i].y && r >= l + t - 1) {
          Ok = 1;
          break;
        }
      }
      if (!Ok) break;
      Ans++;
    }
  }
  for (int i = 1; i <= Q; i++) printf("%d\n", ans[i]);
  return 0;
}
