#include <bits/stdc++.h>
using namespace std;
const int sz = 2018;
int n, m, qx[sz], qy[sz], q, bc, fl[sz][sz], fr[sz][sz], u[sz][sz], f[sz][sz],
    ans[sz];
char s[sz][sz];
int lfind(int i, int j) {
  return fl[i][j] == j ? j : fl[i][j] = lfind(i, fl[i][j]);
}
int rfind(int i, int j) {
  return fr[i][j] == j ? j : fr[i][j] = rfind(i, fr[i][j]);
}
void get(int i, int j) {
  fr[i][j] = j + 1;
  fl[i][j] = j - 1;
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
  for (int i = 1; i <= q; i++)
    scanf("%d%d", &qx[i], &qy[i]), s[qx[i]][qy[i]] = 'X';
  for (int i = 1; i <= n; i++) {
    fr[i][m + 1] = m + 1;
    for (int j = 1; j <= m; j++) {
      fl[i][j] = fr[i][j] = j;
      u[i][j] = i;
      if (s[i][j] == '.') {
        get(i, j);
        u[i][j] = u[i - 1][j];
        f[i][j] = min(f[i - 1][j - 1] + 1, min(i - u[i][j], j - lfind(i, j)));
        bc = bc > f[i][j] ? bc : f[i][j];
      }
    }
  }
  int z[sz], y[sz];
  for (int k = q; k >= 1; k--) {
    ans[k] = bc;
    get(qx[k], qy[k]);
    for (int i = 1; i <= n; i++)
      z[i] = qy[k] - lfind(i, qy[k]), y[i] = rfind(i, qy[k]) - qy[k];
    for (int i = qx[k] - 1; i >= 1; i--)
      z[i] = min(z[i], z[i + 1]), y[i] = min(y[i], y[i + 1]);
    for (int i = qx[k] + 1; i <= n; i++)
      z[i] = min(z[i], z[i - 1]), y[i] = min(y[i], y[i - 1]);
    for (int i = 1; i <= qx[k]; i++)
      while (i + bc <= n &&
             min(z[i], z[i + bc]) + min(y[i], y[i + bc]) - 1 > bc)
        bc++;
  }
  for (int i = 1; i <= q; i++) printf("%d\n", ans[i]);
  return 0;
}
