#include <bits/stdc++.h>
using namespace std;
const int maxn = 5010, inf = 0x7fffffff;
bool has[maxn][maxn], flag = 0;
int l[maxn][maxn], r[maxn][maxn], n, m, k, ans[maxn], effect;
char s[maxn];
struct element {
  int num, po;
};
struct wtf_queue {
  int head, tail;
  element a[maxn];
  void push(element el) {
    while (tail >= head && el.num < a[tail].num) tail--;
    a[++tail] = el;
  }
  bool empty() { return head > tail; }
  void pop() { head++; }
  element top() { return a[head]; }
} lq, rq;
int operator+(element a, element b) { return a.num + b.num; }
void update(int row) {
  for (int i = 1; i <= m; i++)
    l[row][i] = has[row][i] == 0 ? l[row][i - 1] + 1 : 0;
  for (int i = m; i >= 1; i--)
    r[row][i] = has[row][i] == 0 ? r[row][i + 1] + 1 : 0;
}
int maxarea(int o, int left, int right) {
  if (effect != 0 && (effect < left || effect > right)) return ans[o];
  if (left == right) return ans[o] = 0;
  int maxleng = -1, ll, rr, uu = 1, dd = 1;
  int midl = (left + right) >> 1, midr = midl + 1;
  int maxleft = midl - left + 1, maxright = right - midr + 1;
  maxleng = max(maxleng, maxarea(o << 1, left, midl));
  maxleng = max(maxleng, maxarea((o << 1) + 1, midr, right));
  lq.head = rq.head = 1;
  lq.tail = rq.tail = 0;
  element lt, rt;
  for (int i = 1; i <= n; i++, dd++) {
    lq.push((element){l[i][midl], i});
    rq.push((element){r[i][midr], i});
    lt = lq.top();
    rt = rq.top();
    while (lt + rt < dd - uu + 1) {
      uu = min(lt.po, rt.po) + 1;
      if (lt.po < uu) lq.pop();
      if (rt.po < uu) rq.pop();
      if (lq.empty() == 1 || rq.empty() == 1) break;
      lt = lq.top();
      rt = rq.top();
      maxleng = max(maxleng, min(min(lt.num, maxleft) + min(rt.num, maxright),
                                 dd - uu + 1));
    }
    maxleng = max(maxleng, min(min(lt.num, maxleft) + min(rt.num, maxright),
                               dd - uu + 1));
  }
  return ans[o] = maxleng;
}
void init() {
  for (int i = 1; i <= n; i++) {
    l[i][0] = 0;
    r[i][m + 1] = 0;
    update(i);
  }
  memset(ans, -1, sizeof(ans));
  effect = 0;
  maxarea(1, 1, m);
}
int main() {
  while (scanf("%d%d%d", &n, &m, &k) == 3) {
    memset(has, 0, sizeof(has));
    flag = 0;
    if (n > m) flag = 1;
    for (int i = 1; i <= n; i++) {
      scanf("%s", s);
      for (int j = 1; j <= m; j++)
        (flag == 1 ? has[m - j + 1][i] : has[i][j]) = (s[j - 1] == '.' ? 0 : 1);
    }
    if (flag == 1) swap(n, m);
    init();
    for (int i = 1; i <= k; i++) {
      int x, y;
      scanf("%d %d", &x, &y);
      (flag == 1 ? has[n - y + 1][x] : has[x][y]) = 1;
      update(flag == 1 ? n - y + 1 : x);
      effect = (flag == 1 ? x : y);
      printf("%d\n", maxarea(1, 1, m));
    }
  }
  return 0;
}
