#include <bits/stdc++.h>
using namespace std;
const int N = 2017;
int L[N][N], R[N][N];
int b[N][N], p[N], q[N], x[N], y[N], z[N];
char c[N][N];
int h, i, j, k, m, n, l, r;
int main() {
  scanf("%d%d%d\n", &n, &m, &k);
  for (i = 1; i <= n; i++) gets(c[i] + 1);
  for (i = 1; i <= k; i++) scanf("%d%d", &x[i], &y[i]), c[x[i]][y[i]] = 'X';
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++)
      if (c[i][j] == 'X')
        L[i][j] = 0;
      else
        L[i][j] = L[i][j - 1] + 1;
  for (i = n; i > 0; i--)
    for (j = m; j > 0; j--)
      if (c[i][j] == 'X')
        R[i][j] = 0;
      else
        R[i][j] = R[i][j + 1] + 1;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++)
      if (c[i][j] == 'X')
        b[i][j] = 0;
      else
        b[i][j] = min(min(b[i][j - 1], b[i - 1][j]), b[i - 1][j - 1]) + 1;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) z[k + 1] = max(z[k + 1], b[i][j]);
  for (h = k; h > 0; h--) {
    c[x[h]][y[h]] = '.';
    for (i = x[h], j = 1; j <= m; j++)
      if (c[i][j] == 'X')
        L[i][j] = 0;
      else
        L[i][j] = L[i][j - 1] + 1;
    for (i = x[h], j = m; j > 0; j--)
      if (c[i][j] == 'X')
        R[i][j] = 0;
      else
        R[i][j] = R[i][j + 1] + 1;
    for (i = 1; i <= n; i++)
      p[i] = y[h] - L[i][y[h]] + 1, q[i] = y[h] + R[i][y[h]] - 1;
    for (i = x[h] - 1; i > 0; i--)
      p[i] = max(p[i], p[i + 1]), q[i] = min(q[i], q[i + 1]);
    for (i = x[h] + 1; i <= n; i++)
      p[i] = max(p[i], p[i - 1]), q[i] = min(q[i], q[i - 1]);
    z[h] = z[h + 1];
    for (i = 1; i <= x[h]; i++)
      for (j = max(i + z[h], x[h]);
           (j <= n) && (min(q[i], q[j]) - max(p[i], p[j]) + 1 > z[h]); j++)
        z[h] = min(j - i + 1, min(q[i], q[j]) - max(p[i], p[j]) + 1);
  }
  for (i = 2; i <= k + 1; i++) printf("%d\n", z[i]);
  return 0;
}
