#include <bits/stdc++.h>
using namespace std;
int read() {
  char c = getchar();
  int d = 0, f = 1;
  for (; c < '0' || c > '9'; c = getchar())
    if (c == '-') f = -1;
  for (; c >= '0' && c <= '9'; d = d * 10 + c - 48, c = getchar())
    ;
  return d * f;
}
const int N = 2010;
const int mod = 1e9 + 7;
int n, m, k;
char s[N][N];
pair<int, int> p[N];
int ans;
int dp[N][N], t1[N][N], t2[N][N];
void init() {
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      if (s[i][j] != 'X')
        dp[i][j] = min(min(dp[i - 1][j], dp[i][j - 1]), dp[i - 1][j - 1]) + 1;
  for (int j = 1; j <= m; ++j) t1[0][j] = 0, t2[n + 1][j] = n + 1;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      if (s[i][j] == 'X')
        t1[i][j] = i;
      else
        t1[i][j] = t1[i - 1][j];
  for (int i = n; i >= 1; --i)
    for (int j = 1; j <= m; ++j)
      if (s[i][j] == 'X')
        t2[i][j] = i;
      else
        t2[i][j] = t2[i + 1][j];
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) ans = max(ans, dp[i][j]);
}
vector<int> Ans;
pair<int, int> a1[N], a2[N];
bool check(int x, int y, int le) {
  int h1 = 1, ta1 = 0, h2 = 1, ta2 = 0;
  int op = max(1, y - le + 1), ed = min(y, m - le + 1);
  for (int i = op; i <= op + le - 1; ++i) {
    pair<int, int> w = make_pair(t1[x][i], i);
    while (h1 <= ta1 && a1[ta1] < w) ta1--;
    a1[++ta1] = w;
    w = make_pair(t2[x][i], i);
    while (h2 <= ta2 && a2[ta2] > w) ta2--;
    a2[++ta2] = w;
  }
  for (int i = op; i <= ed; ++i) {
    if (a2[h2].first - a1[h1].first - 1 >= le) return 1;
    while (h1 <= ta1 && a1[h1].second == i) h1++;
    while (h2 <= ta2 && a2[h2].second == i) h2++;
    if (i + le <= m) {
      pair<int, int> w = make_pair(t1[x][i + le], i + le);
      while (h1 <= ta1 && a1[ta1] < w) ta1--;
      a1[++ta1] = w;
      w = make_pair(t2[x][i + le], i + le);
      while (h2 <= ta2 && a2[ta2] > w) ta2--;
      a2[++ta2] = w;
    }
  }
  return 0;
}
int main() {
  n = read(), m = read(), k = read();
  for (int i = 1; i <= n; ++i) scanf("%s", s[i] + 1);
  for (int i = 1; i <= k; ++i) p[i].first = read(), p[i].second = read();
  for (int i = 1; i <= k; ++i) s[p[i].first][p[i].second] = 'X';
  init();
  Ans.push_back(ans);
  for (int I = k; I >= 2; --I) {
    int x = p[I].first, y = p[I].second;
    s[x][y] = '.';
    for (int i = 1; i <= n; ++i)
      if (s[i][y] == 'X')
        t1[i][y] = i;
      else
        t1[i][y] = t1[i - 1][y];
    for (int i = n; i >= 1; --i)
      if (s[i][y] == 'X')
        t2[i][y] = i;
      else
        t2[i][y] = t2[i + 1][y];
    while (ans < min(n, m) && check(x, y, ans + 1)) ans++;
    Ans.push_back(ans);
  }
  for (int i = ((int)Ans.size()) - 1; i >= 0; --i) cout << Ans[i] << endl;
}
