#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2005;
int n, m, k, l[MAXN][MAXN], r[MAXN][MAXN];
char S[MAXN];
int a[MAXN][MAXN], dp[MAXN][MAXN], x[MAXN], y[MAXN], ans[MAXN];
void clr(int i) {
  for (int j = 1; j <= m; ++j) l[i][j] = a[i][j] ? 0 : l[i][j - 1] + 1;
  for (int j = m; j >= 1; --j) r[i][j] = a[i][j] ? 0 : r[i][j + 1] + 1;
}
int solve() {
  int re = 0;
  for (int i = 1; i <= n; ++i) clr(i);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      if (!a[i][j]) {
        dp[i][j] = min(min(dp[i - 1][j], dp[i][j - 1]), dp[i - 1][j - 1]) + 1;
        re = max(re, dp[i][j]);
      }
  return re;
}
int v[2][MAXN], q[2][MAXN], s[2], t[2];
inline void del(int p) {
  while (s[0] < t[0] && q[0][s[0]] <= p) ++s[0];
  while (s[1] < t[1] && q[1][s[1]] <= p) ++s[1];
}
inline void ins(int i) {
  while (s[0] < t[0] && v[0][q[0][t[0] - 1]] >= v[0][i]) --t[0];
  q[0][t[0]++] = i;
  while (s[1] < t[1] && v[1][q[1][t[1] - 1]] >= v[1][i]) --t[1];
  q[1][t[1]++] = i;
}
bool calc(int j, int len) {
  for (int i = 1; i <= n; ++i) v[0][i] = l[i][j], v[1][i] = r[i][j];
  s[0] = s[1] = t[0] = t[1] = 0;
  q[0][0] = q[1][0] = 0;
  for (int i = 1, p = 0; i <= n; ++i) {
    while (i - p >= len) del(p++);
    ins(i);
    if (i >= len && v[0][q[0][s[0]]] + v[1][q[1][s[1]]] - 1 >= len) return 1;
  }
  return 0;
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; ++i) {
    scanf("%s", S + 1);
    for (int j = 1; j <= m; ++j) a[i][j] = S[j] == 'X';
  }
  for (int i = 1; i <= k; ++i) scanf("%d%d", &x[i], &y[i]), a[x[i]][y[i]] = 1;
  ans[k] = solve();
  for (int i = k; i > 1; --i) {
    a[x[i]][y[i]] = 0;
    clr(x[i]);
    for (ans[i - 1] = ans[i]; calc(y[i], ans[i - 1] + 1); ++ans[i - 1])
      ;
  }
  for (int i = 1; i <= k; ++i) printf("%d\n", ans[i]);
}
