#include <bits/stdc++.h>
using namespace std;
template <class T>
void debug(T a, T b) {
  ;
}
template <class T>
void chmin(T& a, const T& b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T& a, const T& b) {
  if (a < b) a = b;
}
namespace std {
template <class S, class T>
ostream& operator<<(ostream& out, const pair<S, T>& a) {
  out << '(' << a.first << ',' << a.second << ')';
  return out;
}
}  // namespace std
long long int readL() {
  long long int res;
  scanf("%I64d", &res);
  return res;
}
void printL(long long int res) { printf("%I64d", res); }
static const int MAXN = 2005;
struct BIT {
  int val[MAXN * 2 + 2];
  int n;
  void init(int n_) {
    n = 1;
    while (n < n_) n <<= 1;
    for (int i = 0; i < (n + 1); ++i) val[i] = 0;
  }
  void add(int k, int a) {
    ++k;
    while (k <= n) {
      val[k] += a;
      k += k & -k;
    }
  }
  int query(int k) {
    int res = 0;
    while (k > 0) {
      res += val[k];
      k -= k & -k;
    }
    return res;
  }
  int query(int l, int r) { return query(r) - query(l); }
};
BIT bit[2005];
int h, w, k;
char buf[2005][2005];
pair<int, int> ps[2005];
int res[2005];
int dp[2005][2005];
int getans() {
  int res = 0;
  for (int i = 0; i < (h); ++i)
    for (int j = 0; j < (w); ++j) {
      if (buf[i][j] == 'X')
        ;
      else if (i == 0 || j == 0)
        dp[i][j] = 1;
      else
        dp[i][j] = min({dp[i - 1][j], dp[i][j - 1], dp[i - 1][j - 1]}) + 1;
      chmax(res, dp[i][j]);
    }
  return res;
}
int main() {
  cin >> h >> w >> k;
  for (int i = 0; i < (h); ++i) scanf("%s", buf[i]);
  for (int i = 0; i < (k); ++i) {
    int y, x;
    scanf("%d%d", &y, &x);
    --y;
    --x;
    ps[i] = make_pair(y, x);
    buf[y][x] = 'X';
  }
  for (int i = 0; i < (h); ++i) bit[i].init(w);
  for (int i = 0; i < (h); ++i)
    for (int j = 0; j < (w); ++j)
      if (buf[i][j] == 'X') {
        bit[i].add(j, 1);
      }
  res[k - 1] = getans();
  int ans = res[k - 1];
  static int right[2005], left[2005];
  for (int i = k - 1; i > 0; --i) {
    int y = ps[i].first, x = ps[i].second;
    bit[y].add(x, -1);
    int p = w - 1, q = 0;
    for (int j = y; j >= 0; --j) {
      while (bit[j].query(x, p + 1) > 0) --p;
      right[j] = p;
      while (bit[j].query(q, x + 1) > 0) ++q;
      left[j] = q;
    }
    p = w - 1;
    q = 0;
    for (int j = y; j < h; ++j) {
      while (bit[j].query(x, p + 1) > 0) --p;
      right[j] = p;
      while (bit[j].query(q, x + 1) > 0) ++q;
      left[j] = q;
    }
    bool changed = true;
    while (changed) {
      changed = false;
      int tmp = ans + 1;
      for (int j = 0; j < (y + 1); ++j)
        if (right[j] >= x) {
          int a = j, b = right[j], c = j + tmp - 1, d = b - tmp + 1;
          if (c >= h || d < 0) continue;
          if (right[c] >= b && left[c] <= d && left[a] <= d) {
            changed = true;
            ++ans;
            goto exi;
          }
        }
      for (int j = (y); j < (h); ++j)
        if (right[j] >= x) {
          int a = j, b = right[j], c = j - tmp + 1, d = b - tmp + 1;
          if (c < 0 || d < 0) continue;
          if (right[c] >= b && left[c] <= d && left[a] <= d) {
            changed = true;
            ++ans;
            goto exi;
          }
        }
    exi:;
    }
    res[i - 1] = ans;
  }
  for (int i = 0; i < (k); ++i) printf("%d\n", res[i]);
  return 0;
}
