#include <bits/stdc++.h>
using namespace std;
int U[2020][2020], D[2020][2020];
int minn1[10000], minn2[10000];
void pushup(int i) {
  minn1[i] = ((minn1[i << 1]) < (minn1[i << 1 | 1]) ? (minn1[i << 1])
                                                    : (minn1[i << 1 | 1]));
  minn2[i] = ((minn2[i << 1]) < (minn2[i << 1 | 1]) ? (minn2[i << 1])
                                                    : (minn2[i << 1 | 1]));
}
void build(int l, int r, int i, int id) {
  if (l == r) {
    minn1[i] = U[id][l];
    minn2[i] = D[id][l];
    return;
  }
  int mid = (l + r) >> 1;
  build(l, mid, i << 1, id);
  build(mid + 1, r, i << 1 | 1, id);
  pushup(i);
}
int min1, min2;
void query(int l, int r, int pl, int pr, int i) {
  if (l >= pl && r <= pr) {
    min1 = ((min1) < (minn1[i]) ? (min1) : (minn1[i]));
    min2 = ((min2) < (minn2[i]) ? (min2) : (minn2[i]));
    return;
  }
  int mid = (l + r) >> 1;
  if (pl <= mid) query(l, mid, pl, pr, i << 1);
  if (pr > mid) query(mid + 1, r, pl, pr, i << 1 | 1);
}
char s[2020][2020];
int x[2020], y[2020];
int ans[2020];
int d[2020][2020];
bool ok(int i, int j, int k) {
  if (i < k || j < k) return false;
  int ik = i - k, jk = j - k;
  int sum = d[i][j] - d[i][jk] - d[ik][j] + d[ik][jk];
  if (sum == 0) return true;
  return false;
}
int n, m;
bool check(int i, int j, int k) {
  if (j + 1 < k) return false;
  min1 = min2 = 100000000;
  query(0, m - 1, j - k + 1, j, 1);
  if (min1 + min2 - 1 >= k) return true;
  return false;
}
int main() {
  int k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < n; ++i) scanf(" %s", s[i]);
  for (int i = 0; i < k; ++i) {
    scanf("%d%d", &x[i], &y[i]);
    x[i]--, y[i]--;
    s[x[i]][y[i]] = 'X';
  }
  for (int i = 1; i <= n; ++i) {
    int cnt = 0;
    for (int j = 1; j <= m; ++j) {
      cnt += (s[i - 1][j - 1] == 'X');
      d[i][j] = d[i - 1][j] + cnt;
    }
  }
  for (int i = 0; i < m; ++i) {
    U[0][i] = (s[0][i] == '.');
    D[n - 1][i] = (s[n - 1][i] == '.');
    for (int j = 1; j < n; ++j) {
      if (s[j][i] == 'X') {
        U[j][i] = 0;
        continue;
      }
      U[j][i] = U[j - 1][i] + 1;
    }
    for (int j = n - 2; j >= 0; --j) {
      if (s[j][i] == 'X') {
        D[j][i] = 0;
        continue;
      }
      D[j][i] = D[j + 1][i] + 1;
    }
  }
  int res = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      while (ok(i, j, res + 1)) res++;
    }
  }
  for (int i = k - 1; i >= 0; --i) {
    ans[i] = res;
    s[x[i]][y[i]] = '.';
    U[0][y[i]] = (s[0][y[i]] == '.');
    D[n - 1][y[i]] = (s[n - 1][y[i]] == '.');
    for (int j = 1; j < n; ++j) {
      if (s[j][y[i]] == 'X') {
        U[j][y[i]] = 0;
        continue;
      }
      U[j][y[i]] = U[j - 1][y[i]] + 1;
    }
    for (int j = n - 2; j >= 0; --j) {
      if (s[j][y[i]] == 'X') {
        D[j][y[i]] = 0;
        continue;
      }
      D[j][y[i]] = D[j + 1][y[i]] + 1;
    }
    build(0, m - 1, 1, x[i]);
    for (int j = 0; j < m; ++j) {
      while (check(x[i], j, res + 1)) res++;
    }
  }
  for (int i = 0; i < k; ++i) printf("%d\n", ans[i]);
  return 0;
}
