#include <bits/stdc++.h>
using namespace std;
const int maxn = 2005;
int l[maxn][maxn], r[maxn][maxn], cz[maxn][2], Ans[maxn], ans, n, m, k,
    a[maxn][maxn], f[maxn][maxn], dp[maxn][2];
int findl(int x, int y) {
  if (l[x][y] == y)
    return y;
  else
    return l[x][y] = findl(x, l[x][y]);
}
int findr(int x, int y) {
  if (r[x][y] == y)
    return y;
  else
    return r[x][y] = findr(x, r[x][y]);
}
bool pd(int y) {
  if (min(dp[y][0], dp[y - ans][0]) - max(dp[y][1], dp[y - ans][1]) - 1 > ans)
    return 1;
  return 0;
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  char tmp;
  scanf("%c", &tmp);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++)
      scanf("%c", &tmp), a[i][j] = tmp == '.' ? 0 : 1;
    scanf("%c", &tmp);
  }
  for (int i = 1; i <= k; i++)
    scanf("%d%d", &cz[i][0], &cz[i][1]), a[cz[i][0]][cz[i][1]] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      l[i][j] = a[i][j] ? j : j + 1;
      r[i][j] = a[i][j] ? j : j - 1;
    }
    l[i][m + 1] = m + 1;
    r[i][0] = 0;
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (a[i][j])
        f[i][j] = 0;
      else
        f[i][j] = min(f[i - 1][j - 1], min(f[i - 1][j], f[i][j - 1])) + 1,
        ans = max(ans, f[i][j]);
  for (int i = k; i; i--) {
    Ans[i] = ans;
    int x = cz[i][0], y = cz[i][1];
    l[x][y] = findl(x, y + 1);
    r[x][y] = findr(x, y - 1);
    bool b = 1;
    dp[x][0] = findl(x, y);
    dp[x][1] = findr(x, y);
    for (int i = x + 1; i <= n; i++)
      dp[i][0] = min(dp[i - 1][0], findl(i, y)),
      dp[i][1] = max(dp[i - 1][1], findr(i, y));
    for (int i = x - 1; i; i--)
      dp[i][0] = min(dp[i + 1][0], findl(i, y)),
      dp[i][1] = max(dp[i + 1][1], findr(i, y));
    while (b) {
      b = 0;
      for (int j = ((ans + x) > n) ? n : (ans + x);
           j >= (x > (ans + 1) ? x : (ans + 1)); j--)
        if (pd(j)) {
          ans++;
          b = 1;
          break;
        }
    }
  }
  for (int i = 1; i <= k; i++) printf("%d\n", Ans[i]);
  return 0;
}
