#include <bits/stdc++.h>
using namespace std;
char buf[1 << 15], *fs, *ft;
inline char getc() {
  return (fs == ft &&
          (ft = (fs = buf) + fread(buf, 1, 1 << 15, stdin), fs == ft))
             ? 0
             : *fs++;
}
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int MAXN = 2010;
int n, m, k, cnt;
char a[MAXN][MAXN];
struct wy {
  int x, y;
} t[MAXN];
int l[MAXN][MAXN], r[MAXN][MAXN];
int f[MAXN][MAXN], ans[MAXN];
int L, R, q[MAXN], w[MAXN];
inline int check(int d, int y) {
  L = 1;
  R = 0;
  for (int i = 1; i <= n; ++i) {
    while (L <= R && l[q[R]][y] >= l[i][y]) --R;
    q[++R] = i;
    while (L <= R && q[L] <= i - d) ++L;
    w[i] = l[q[L]][y];
  }
  L = 1;
  R = 0;
  for (int i = 1; i <= n; ++i) {
    while (L <= R && r[q[R]][y] >= r[i][y]) --R;
    q[++R] = i;
    while (L <= R && q[L] <= i - d) ++L;
    w[i] += r[q[L]][y] - 1;
  }
  for (int i = d; i <= n; ++i)
    if (w[i] >= d) return 1;
  return 0;
}
int main() {
  n = read();
  m = read();
  k = read();
  for (int i = 1; i <= n; ++i) scanf("%s", a[i] + 1);
  for (int i = 1; i <= k; ++i) {
    int x, y;
    x = read();
    y = read();
    t[i] = (wy){x, y};
    a[x][y] = 'X';
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (a[i][j] == 'X') {
        l[i][j] = 0;
        f[i][j] = 0;
        continue;
      }
      l[i][j] = l[i][j - 1] + 1;
      f[i][j] = ((f[i][j - 1]) > (((f[i - 1][j - 1]) > (f[i - 1][j])
                                       ? (f[i - 1][j])
                                       : (f[i - 1][j - 1])))
                     ? (((f[i - 1][j - 1]) > (f[i - 1][j]) ? (f[i - 1][j])
                                                           : (f[i - 1][j - 1])))
                     : (f[i][j - 1])) +
                1;
      cnt = ((cnt) > (f[i][j]) ? (cnt) : (f[i][j]));
    }
    for (int j = m; j; --j) {
      if (a[i][j] == 'X')
        r[i][j] = 0;
      else
        r[i][j] = r[i][j + 1] + 1;
    }
  }
  for (int i = k - 1; i; --i) {
    ans[i + 1] = cnt;
    int x = t[i + 1].x;
    int y = t[i + 1].y;
    a[x][y] = '.';
    for (int j = 1; j <= m; ++j) l[x][j] = a[x][j] == 'X' ? 0 : l[x][j - 1] + 1;
    for (int j = m; j; --j) r[x][j] = a[x][j] == 'X' ? 0 : r[x][j + 1] + 1;
    while (check(cnt + 1, y)) ++cnt;
  }
  ans[1] = cnt;
  for (int i = 1; i <= k; ++i) printf("%d\n", ans[i]);
  return 0;
}
