#include <bits/stdc++.h>
using namespace std;
const int P = 1e9 + 7, INF = 0x3f3f3f3f;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long qpow(long long a, long long n) {
  long long r = 1 % P;
  for (a %= P; n; a = a * a % P, n >>= 1)
    if (n & 1) r = r * a % P;
  return r;
}
long long inv(long long first) {
  return first <= 1 ? 1 : inv(P % first) * (P - P / first) % P;
}
const int N = 2e3 + 10;
int n, m, k, ans, Ans[N];
char s[N][N];
int dp[N][N], L[N][N], R[N][N], first[N], second[N];
void upd(int i) {
  for (int j = 1; j <= m; ++j)
    if (s[i][j] == '.') L[i][j] = L[i][j - 1] ? L[i][j - 1] : j;
  for (int j = m; j >= 1; --j)
    if (s[i][j] == '.') R[i][j] = R[i][j + 1] ? R[i][j + 1] : j;
}
void DP() {
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      if (s[i][j] == '.') {
        dp[i][j] = min({dp[i - 1][j], dp[i][j - 1], dp[i - 1][j - 1]}) + 1;
        ans = max(ans, dp[i][j]);
      }
  for (int i = 1; i <= n; ++i) upd(i);
}
int chk(int U, int D, int second, int v) {
  if (D - U + 1 < v) return 0;
  deque<int> q1, q2;
  for (int i = U; i <= D; ++i) {
    if (q1.size() && i - q1[0] == v) q1.pop_front();
    if (q2.size() && i - q2[0] == v) q2.pop_front();
    while (q1.size() && L[i][second] >= L[q1.back()][second]) q1.pop_back();
    while (q2.size() && R[i][second] <= R[q2.back()][second]) q2.pop_back();
    q1.push_back(i), q2.push_back(i);
    if (i - U + 1 >= v && R[q2[0]][second] - L[q1[0]][second] + 1 >= v)
      return 1;
  }
  return 0;
}
int main() {
  scanf("%d%d%d", &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';
  }
  DP();
  for (int i = k; i >= 1; --i) {
    Ans[i] = ans;
    s[first[i]][second[i]] = '.', upd(first[i]);
    int U = first[i], D = first[i];
    while (s[U][second[i]] == '.') --U;
    ++U;
    while (s[D][second[i]] == '.') ++D;
    --D;
    while (chk(U, D, second[i], ans + 1)) ++ans;
  }
  for (int i = 1; i <= k; ++i) printf("%d\n", Ans[i]);
}
