#include <bits/stdc++.h>
using namespace std;
inline void MAX(int &a, int b) {
  if (b > a) a = b;
}
inline void MIN(int &a, int b) {
  if (b < a) a = b;
}
int n, m, q, as, f[2005][2005], u[2005][2005], lg[2005], rg[2005], qx[2005],
    qy[2005], ans[2005];
char s[2005][2005];
struct line {
  int f[2005];
  int get(int v) { return f[v] == v ? v : f[v] = get(f[v]); }
} l[2005], r[2005];
void del(int x, int y) {
  l[x].f[y] = l[x].get(y - 1);
  r[x].f[y] = r[x].get(y + 1);
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m + 1; ++j) {
      l[i].f[j] = j;
      r[i].f[j] = j;
      u[i][j] = i;
    }
  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)
    for (int j = 1; j <= m; ++j)
      if (s[i][j] == '.') del(i, j);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      if (s[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 - l[i].get(j)));
        MAX(as, f[i][j]);
      }
  for (int v = q; v >= 1; --v) {
    ans[v] = as;
    del(qx[v], qy[v]);
    for (int i = 1; i <= n; ++i) {
      lg[i] = qy[v] - l[i].get(qy[v]);
      rg[i] = r[i].get(qy[v]) - qy[v];
    }
    for (int i = qx[v] - 1; i >= 1; --i)
      MIN(lg[i], lg[i + 1]), MIN(rg[i], rg[i + 1]);
    for (int i = qx[v] + 1; i <= n; ++i)
      MIN(lg[i], lg[i - 1]), MIN(rg[i], rg[i - 1]);
    for (int i = 1; i <= qx[v]; ++i)
      while (i + as <= n &&
             min(rg[i], rg[i + as]) + min(lg[i], lg[i + as]) - 1 > as)
        ++as;
  }
  for (int i = 1; i <= q; ++i) printf("%d\n", ans[i]);
}
