#include <bits/stdc++.h>
using namespace std;
int power(int a, int b, int c, int ans = 1) {
  for (; b; b >>= 1, a = (long long)a * a % c)
    if (b & 1) ans = (long long)ans * a % c;
  return ans;
}
char s[2020][2020];
int first[2020], second[2020];
int dn[2020][2020], up[2020][2020], ans[2020];
int q1[2020], q2[2020];
int n, m;
int can(int up[], int dn[], int d) {
  if (d > min(n, m)) return 0;
  int st1 = 0, ed1 = -1, st2 = 0, ed2 = -1;
  for (int i = 1; i <= m; i++) {
    while (st1 <= ed1 && dn[q1[ed1]] >= dn[i]) ed1--;
    while (st2 <= ed2 && up[q2[ed2]] >= up[i]) ed2--;
    q1[++ed1] = i;
    q2[++ed2] = i;
    if (q1[st1] == i - d) st1++;
    if (q2[st2] == i - d) st2++;
    if (i >= d && dn[q1[st1]] + up[q2[st2]] >= d + 1) return 1;
  }
  return 0;
}
int main() {
  int k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
  for (int i = 1; i <= k; i++)
    scanf("%d%d", first + i, second + i), s[first[i]][second[i]] = 'X';
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (s[i][j] == '.') up[i][j] = 1 + up[i - 1][j];
  for (int i = n; i >= 1; i--)
    for (int j = 1; j <= m; j++)
      if (s[i][j] == '.') dn[i][j] = 1 + dn[i + 1][j];
  int cur = 0;
  for (int i = 1; i <= n; i++)
    while (can(up[i], dn[i], cur + 1)) cur++;
  for (int i = k; i >= 1; i--) {
    ans[i] = cur;
    int second = ::second[i], first = ::first[i];
    s[first][second] = '.';
    for (int r = first; r <= n && s[r][second] == '.'; r++)
      up[r][second] = 1 + up[r - 1][second];
    for (int r = first; r >= 1 && s[r][second] == '.'; r--)
      dn[r][second] = 1 + dn[r + 1][second];
    while (can(up[first], dn[first], cur + 1)) cur++;
  }
  for (int i = 1; i <= k; i++) printf("%d\n", ans[i]);
  return 0;
}
