#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2010;
int n, m, k;
int ans[MAXN];
int dp[MAXN][MAXN];
int blockedL[MAXN][MAXN];
int blockedR[MAXN][MAXN];
char v[MAXN][MAXN];
vector<pair<int, int> > sweep;
int solve(int i, int j) {
  if (i > n || j > m) return 0;
  int& ans = dp[i][j];
  if (ans != -1) return ans;
  if (v[i][j] == 'X') return ans = 0;
  ans = min(solve(i, j + 1), solve(i + 1, j));
  ans = min(ans, solve(i + 1, j + 1));
  return ++ans;
}
void update(int k) {
  blockedL[k][0] = 0;
  blockedR[k][m + 1] = m + 1;
  for (int i = 1; i <= m; i++) {
    if (v[k][i] == 'X')
      blockedL[k][i] = i;
    else
      blockedL[k][i] = blockedL[k][i - 1];
  }
  for (int i = m; i > 0; i--) {
    if (v[k][i] == 'X')
      blockedR[k][i] = i;
    else
      blockedR[k][i] = blockedR[k][i + 1];
  }
}
bool findSquare(int x, int y, int k) {
  int R = x + k - 1;
  while (R > n) R--;
  int L = R - k + 1;
  if (L < 0) return false;
  multiset<int> leftWall;
  multiset<int> rightWall;
  for (int i = L; i <= R; i++) {
    leftWall.insert(-blockedL[i][y]);
    rightWall.insert(blockedR[i][y]);
  }
  while (R >= x && L > 0) {
    int sz = *rightWall.begin() + *leftWall.begin() - 1;
    if (sz >= k) return true;
    leftWall.erase(leftWall.find(-blockedL[R][y]));
    rightWall.erase(rightWall.find(blockedR[R][y]));
    L--;
    R--;
    leftWall.insert(-blockedL[L][y]);
    rightWall.insert(blockedR[L][y]);
  }
  return false;
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  memset(dp, -1, sizeof(dp));
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf(" %c", &v[i][j]);
  sweep.push_back({0, 0});
  for (int i = 1; i <= k; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    v[x][y] = 'X';
    sweep.push_back({x, y});
  }
  for (int i = 1; i <= n; i++) update(i);
  int mx = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) mx = max(mx, solve(i, j));
  for (int i = k; i > 0; i--) {
    ans[i] = mx;
    int X = sweep[i].first;
    int Y = sweep[i].second;
    v[X][Y] = '.';
    update(X);
    while (findSquare(X, Y, mx + 1)) mx++;
  }
  for (int i = 1; i <= k; i++) printf("%d\n", ans[i]);
}
