#include <bits/stdc++.h>
using namespace std;
const int maxn = 2050, maxk = maxn;
int n, m, K, ans[maxk];
bool mat[maxn][maxn];
int x[maxk], y[maxk];
int f[maxn][maxn];
struct DSU {
  int f[maxn];
  DSU() {
    int i;
    for (i = 0; i < maxn; i++) f[i] = i;
  }
  inline int find(int x) { return f[x] == x ? x : f[x] = find(f[x]); }
} l[maxn], r[maxn];
int gl[maxn], gr[maxn];
int main() {
  int i, j, cur = 0;
  scanf("%d%d%d\n", &n, &m, &K);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) mat[i][j] = (getchar() == 'X');
    scanf("\n");
  }
  for (i = 1; i <= K; i++) scanf("%d%d", &x[i], &y[i]), mat[x[i]][y[i]] = 1;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++)
      if (!mat[i][j]) {
        l[i].f[j] = j - 1;
        r[i].f[j] = j + 1;
        f[i][j] = min(f[i - 1][j - 1], min(f[i - 1][j], f[i][j - 1])) + 1;
        cur = max(cur, f[i][j]);
      }
  for (i = K; i; i--) {
    int x0 = x[i], y0 = y[i];
    ans[i] = cur;
    mat[x0][y0] = 0;
    gl[x0] = l[x0].f[y0] = l[x0].find(y0 - 1);
    gr[x0] = r[x0].f[y0] = r[x0].find(y0 + 1);
    for (j = x0 - 1; j; j--) {
      gl[j] = max(gl[j + 1], l[j].find(y0));
      gr[j] = min(gr[j + 1], r[j].find(y0));
    }
    for (j = x0 + 1; j <= n; j++) {
      gl[j] = max(gl[j - 1], l[j].find(y0));
      gr[j] = min(gr[j - 1], r[j].find(y0));
    }
    for (j = 1; j <= x0; j++)
      while (j + cur <= n &&
             min(gr[j], gr[j + cur]) - max(gl[j], gl[j + cur]) - 1 > cur)
        cur++;
  }
  for (i = 1; i <= K; i++) printf("%d\n", ans[i]);
  return 0;
}
