#include <bits/stdc++.h>
using namespace std;
const int maxn = 2010;
int n, m, K, Ans;
char mp[maxn][maxn];
int L[maxn], R[maxn], U[maxn][maxn], D[maxn][maxn], flag[maxn][maxn], sta[maxn],
    anslist[maxn], Q1[maxn], Q2[maxn];
struct Point {
  int x, y;
} poi[maxn];
void Solve() {
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      U[i][j] = (mp[i][j] == '.') ? U[i - 1][j] + 1 : 0;
    }
  }
  for (int i = n; i >= 1; --i) {
    for (int j = 1; j <= m; ++j) {
      D[i][j] = (mp[i][j] == '.') ? D[i + 1][j] + 1 : 0;
    }
  }
  for (int i = 1; i <= n; ++i) {
    U[i][0] = U[i][m + 1] = -1;
    for (int j = 1, stm = 0; j <= m + 1; ++j) {
      while (stm > 0 && U[i][sta[stm]] > U[i][j]) R[sta[stm--]] = j;
      sta[++stm] = j;
    }
    for (int j = m, stm = 0; j >= 0; --j) {
      while (stm > 0 && U[i][sta[stm]] > U[i][j]) L[sta[stm--]] = j;
      sta[++stm] = j;
    }
    for (int j = 1; j <= m; ++j) {
      Ans = max(Ans, min(U[i][j], j - L[j] + R[j] - j - 1));
    }
  }
}
bool Update(int x, int k) {
  int h1 = 1, t1 = 0, h2 = 1, t2 = 0;
  for (int j = 1; j <= m; ++j) {
    while (h1 <= t1 && j - Q1[h1] + 1 > k) h1++;
    while (h1 <= t1 && U[x][Q1[t1]] >= U[x][j]) t1--;
    Q1[++t1] = j;
    while (h2 <= t2 && j - Q2[h2] + 1 > k) h2++;
    while (h2 <= t2 && D[x][Q2[t2]] >= D[x][j]) t2--;
    Q2[++t2] = j;
    if (j >= k && U[x][Q1[h1]] + D[x][Q2[h2]] - 1 >= k) {
      Ans = k;
      return 1;
    }
  }
  return 0;
}
void Modify(int x, int y) {
  mp[x][y] = '.';
  for (int i = 1; i <= n; ++i)
    U[i][y] = (mp[i][y] == '.') ? U[i - 1][y] + 1 : 0;
  for (int i = n; i >= 1; --i)
    D[i][y] = (mp[i][y] == '.') ? D[i + 1][y] + 1 : 0;
}
int main() {
  scanf("%d%d%d", &n, &m, &K);
  for (int i = 1; i <= n; ++i) {
    scanf("%s", mp[i] + 1);
  }
  for (int i = 1; i <= K; ++i) {
    scanf("%d%d", &poi[i].x, &poi[i].y);
    mp[poi[i].x][poi[i].y] = 'X';
  }
  Solve();
  for (int i = K; i >= 1; --i) {
    anslist[i] = Ans;
    Modify(poi[i].x, poi[i].y);
    while (Update(poi[i].x, Ans + 1))
      ;
  }
  for (int i = 1; i <= K; ++i) {
    printf("%d\n", anslist[i]);
  }
  return 0;
}
