#include <bits/stdc++.h>
using namespace std;
const int maxN = 2000 + 5;
const int mod = 1000 * 1000 * 1000 + 7;
char a[maxN][maxN];
int dp[maxN][maxN];
int X[maxN], Y[maxN], ans[maxN];
int u[maxN][maxN], d[maxN][maxN];
int n, m, k;
void update(int p) {
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (a[i][p] == 'X') {
      cnt = 0;
      u[i][p] = 0;
      continue;
    }
    cnt++;
    u[i][p] = cnt;
  }
  cnt = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (a[i][p] == 'X') {
      cnt = 0;
      d[i][p] = 0;
      continue;
    }
    cnt++;
    d[i][p] = cnt;
  }
}
int seg[4 * maxN], ad[4 * maxN], ps[4 * maxN];
void build(int s, int e, int ind) {
  if (e - s == 1) {
    ps[ind] = 1;
    seg[ind] = 0;
    ad[ind] = 0;
    return;
  }
  int mid = (s + e) >> 1;
  build(s, mid, 2 * ind);
  build(mid, e, 2 * ind + 1);
  seg[ind] = 0;
  ad[ind] = 0;
  ps[ind] = e - s;
}
void shift(int ind) {
  ad[2 * ind + 0] += ad[ind];
  seg[2 * ind + 0] += ad[ind];
  ad[2 * ind + 1] += ad[ind];
  seg[2 * ind + 1] += ad[ind];
  ad[ind] = 0;
}
void update_seg(int ind) {
  ps[ind] = 0;
  seg[ind] = max(seg[2 * ind + 0], seg[2 * ind + 1]);
  if (seg[ind] == seg[2 * ind + 0]) ps[ind] += ps[2 * ind + 0];
  if (seg[ind] == seg[2 * ind + 1]) ps[ind] += ps[2 * ind + 1];
}
void add(int l, int r, int val, int s, int e, int ind) {
  if (l >= e || r <= s) return;
  if (l <= s && e <= r) {
    ad[ind] += val;
    seg[ind] += val;
    return;
  }
  shift(ind);
  int mid = (s + e) >> 1;
  add(l, r, val, s, mid, 2 * ind + 0);
  add(l, r, val, mid, e, 2 * ind + 1);
  update_seg(ind);
}
bool chk(int p, int cnt) {
  build(0, n, 1);
  for (int i = 0; i < m; i++) {
    int st = p - u[p][i] + 1, en = p + d[p][i];
    if (a[p][i] == '.') add(st, en, 1, 0, n, 1);
    if (i >= cnt && a[p][i - cnt] == '.')
      add(p - u[p][i - cnt] + 1, p + d[p][i - cnt], -1, 0, n, 1);
    if (seg[1] == cnt && ps[1] >= cnt) return true;
  }
  return false;
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < n; i++) scanf("%s", &a[i]);
  for (int i = 0; i < k; i++) {
    scanf("%d%d", &X[i], &Y[i]);
    X[i]--;
    Y[i]--;
    a[X[i]][Y[i]] = 'X';
  }
  for (int i = n - 1; i >= 0; i--)
    for (int j = m - 1; j >= 0; j--) {
      if (a[i][j] == 'X') continue;
      dp[i][j] = min(dp[i + 1][j], dp[i][j + 1]) + 1;
      if (dp[i + 1][j] == dp[i][j + 1] &&
          a[i + dp[i + 1][j]][j + dp[i + 1][j]] == 'X')
        dp[i][j]--;
    }
  for (int i = 0; i < m; i++) update(i);
  int answer = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) answer = max(answer, dp[i][j]);
  reverse(X, X + k);
  reverse(Y, Y + k);
  for (int i = 0; i < k; i++) {
    ans[i] = answer;
    a[X[i]][Y[i]] = '.';
    update(Y[i]);
    while (chk(X[i], answer + 1)) answer++;
  }
  for (int i = k - 1; i >= 0; i--) printf("%d\n", ans[i]);
  return 0;
}
