#include <bits/stdc++.h>
using namespace std;
int n, m, kk;
char s[2005];
int a[2001][2001], up[2001][2001], down[2001][2001], f[2001][2001];
int ans[2001], qx[2001], qy[2001], qup[2001], qdown[2001], b[2001], c[2001];
int nowans;
bool check(int row, int length) {
  if (length > min(n, m)) return false;
  int l = 1, r = 1, ll = 1, rr = 1;
  qup[l] = 1;
  qdown[1] = 1;
  for (int i = (1); i <= (m); i++) b[i] = up[row][i];
  for (int i = (1); i <= (m); i++) c[i] = down[row][i];
  if (1 >= length)
    if (b[qup[l]] + c[qdown[ll]] - 1 >= length) return true;
  for (int i = (2); i <= (m); i++) {
    while (b[qup[r]] >= b[i] && r >= l) r--;
    r++;
    qup[r] = i;
    if (i >= length && qup[l] <= i - length) l++;
    while (c[qdown[rr]] >= c[i] && rr >= ll) rr--;
    rr++;
    qdown[rr] = i;
    if (i >= length && qdown[ll] <= i - length) ll++;
    if (i >= length)
      if (b[qup[l]] + c[qdown[ll]] - 1 >= length) return true;
  }
  return false;
}
int main() {
  scanf("%d%d%d", &n, &m, &kk);
  nowans = 0;
  for (int i = (1); i <= (n); i++) {
    scanf("%s", s);
    for (int j = (0); j <= (m - 1); j++) a[i][j + 1] = (s[j] == 'X') ? 0 : 1;
  }
  for (int i = (1); i <= (kk); i++) {
    scanf("%d%d", &qx[i], &qy[i]);
    a[qx[i]][qy[i]] = 0;
  }
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (m); j++) nowans = max(nowans, a[i][j]);
  for (int i = (1); i <= (m); i++) up[1][i] = a[1][i];
  for (int i = (2); i <= (n); i++) {
    for (int j = (1); j <= (m); j++) {
      up[i][j] = a[i][j] == 1 ? up[i - 1][j] + 1 : 0;
    }
  }
  for (int i = (1); i <= (m); i++) down[n][i] = a[n][i];
  for (int i = (n - 1); i >= (1); i--) {
    for (int j = (1); j <= (m); j++) {
      down[i][j] = a[i][j] == 1 ? down[i + 1][j] + 1 : 0;
    }
  }
  for (int i = (1); i <= (n); i++) f[i][1] = a[i][1];
  for (int j = (1); j <= (m); j++) f[1][j] = a[1][j];
  for (int i = (2); i <= (n); i++)
    for (int j = (2); j <= (m); j++) {
      if (a[i][j] == 0)
        f[i][j] = 0;
      else
        f[i][j] = min(min(f[i - 1][j - 1], f[i - 1][j]), f[i][j - 1]) + 1;
      nowans = max(nowans, f[i][j]);
    }
  ans[kk] = nowans;
  for (int ii = (kk); ii >= (2); ii--) {
    a[qx[ii]][qy[ii]] = 1;
    up[1][qy[ii]] = a[1][qy[ii]];
    for (int i = (2); i <= (n); i++)
      if (a[i][qy[ii]] == 0)
        up[i][qy[ii]] = 0;
      else
        up[i][qy[ii]] = up[i - 1][qy[ii]] + 1;
    down[n][qy[ii]] = a[n][qy[ii]];
    for (int i = (n - 1); i >= (1); i--)
      if (a[i][qy[ii]] == 0)
        down[i][qy[ii]] = 0;
      else
        down[i][qy[ii]] = down[i + 1][qy[ii]] + 1;
    int t = 0;
    for (int i = (12); i >= (0); i--)
      if (check(qx[ii], t + (1 << i))) t += (1 << i);
    nowans = max(nowans, t);
    ans[ii - 1] = nowans;
  }
  for (int i = (1); i <= (kk); i++) printf("%d\n", ans[i]);
}
