#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e3 + 10;
int n, m, k;
int Ans;
int dp[maxn][maxn];
int l1[maxn];
int r1[maxn];
int qx[maxn];
int qy[maxn];
int ans[maxn];
char Map[maxn][maxn];
struct node {
  int fa[maxn];
  int findSet(int x) {
    if (x == fa[x])
      return x;
    else
      return fa[x] = findSet(fa[x]);
  }
} l[maxn], r[maxn];
void Delete(int x, int y) {
  l[x].fa[y] = l[x].findSet(y - 1);
  r[x].fa[y] = r[x].findSet(y + 1);
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) scanf("%s", Map[i] + 1);
  for (int i = 1; i <= k; i++) {
    scanf("%d%d", &qx[i], &qy[i]);
    Map[qx[i]][qy[i]] = 'X';
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m + 1; j++) {
      l[i].fa[j] = j;
      r[i].fa[j] = j;
    }
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (Map[i][j] == '.') Delete(i, j);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (Map[i][j] == '.') {
        dp[i][j] = min(dp[i - 1][j - 1], min(dp[i - 1][j], dp[i][j - 1])) + 1;
        Ans = max(Ans, dp[i][j]);
      }
  for (int j = k; j >= 1; --j) {
    ans[j] = Ans;
    Delete(qx[j], qy[j]);
    for (int i = 1; i <= n; i++) {
      l1[i] = qy[j] - l[i].findSet(qy[j]);
      r1[i] = r[i].findSet(qy[j]) - qy[j];
    }
    for (int i = qx[j] + 1; i <= n; i++) {
      l1[i] = min(l1[i], l1[i - 1]);
      r1[i] = min(r1[i], r1[i - 1]);
    }
    for (int i = qx[j] - 1; i; i--) {
      l1[i] = min(l1[i], l1[i + 1]);
      r1[i] = min(r1[i], r1[i + 1]);
    }
    for (int i = 1; i <= qx[j]; i++)
      while (min(r1[i], r1[i + Ans]) + min(l1[i], l1[i + Ans]) - 1 > Ans) Ans++;
  }
  for (int i = 1; i <= k; i++) printf("%d\n", ans[i]);
  return 0;
}
