#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chkmin(T& a, T b) {
  return a > b ? a = b, 1 : 0;
}
template <class T>
bool chkmax(T& a, T b) {
  return a < b ? a = b, 1 : 0;
}
const int maxN = 2005;
struct MyQueue {
  int tail, head;
  int q[maxN];
  void clear() { tail = head = 0; }
  void push_back(int x) { q[++tail] = x; }
  int back() { return q[tail]; }
  int front() { return q[head + 1]; }
  bool empty() { return tail == head; }
  void pop_front() { ++head; }
  void pop_back() { --tail; }
} qu, qd;
int u[maxN][maxN], d[maxN][maxN];
int N, M, K;
int s[maxN][maxN];
int ans[maxN << 2], val[maxN << 2];
void init() {
  scanf("%d%d%d", &N, &M, &K);
  for (int i = 1; i <= N; ++i) {
    for (int j = 1; j <= M; ++j) {
      char c = getchar();
      while (c != '.' && c != 'X') c = getchar();
      s[i][j] = (c == 'X');
    }
  }
  for (int i = 1; i <= N; ++i) {
    for (int j = 1; j <= M; ++j) {
      u[i][j] = (s[i][j] == 0 ? u[i - 1][j] + 1 : 0);
    }
  }
  for (int i = N; i >= 1; --i) {
    for (int j = 1; j <= M; ++j) {
      d[i][j] = (s[i][j] == 0 ? d[i + 1][j] + 1 : 0);
    }
  }
}
int calc(int ubnd, int dbnd) {
  int mid = (ubnd + dbnd) >> 1;
  int lpoint = 0, rpoint = 0;
  int *up = u[mid], *dn = d[mid];
  int ret = 0;
  qu.clear(), qd.clear();
  for (;;) {
    ++rpoint;
    while (qu.empty() == 0 && up[qu.back()] >= up[rpoint]) {
      qu.pop_back();
    }
    qu.push_back(rpoint);
    while (qd.empty() == 0 && dn[qd.back()] >= dn[rpoint]) {
      qd.pop_back();
    }
    qd.push_back(rpoint);
    chkmax(ret, min((min(mid - ubnd + 1, up[qu.front()]) +
                     min(dbnd - mid + 1, dn[qd.front()]) - 1),
                    rpoint - lpoint));
    if (rpoint == M) break;
    while (lpoint < rpoint &&
           (min(mid - ubnd + 1, up[qu.front()]) +
            min(dbnd - mid + 1, dn[qd.front()]) - 1) <= rpoint - lpoint) {
      lpoint++;
      if (qu.front() == lpoint) qu.pop_front();
      if (qd.front() == lpoint) qd.pop_front();
    }
  }
  return ret;
}
void build(int now, int ubnd, int dbnd) {
  int mid = (ubnd + dbnd) >> 1;
  ans[now] = val[now] = calc(ubnd, dbnd);
  if (ubnd == dbnd) return;
  build((now << 1), ubnd, mid);
  build((now << 1 | 1), mid + 1, dbnd);
  ans[now] = max(val[now], max(ans[(now << 1)], ans[(now << 1 | 1)]));
}
void work(int now, int ubnd, int dbnd, int x) {
  int mid = (ubnd + dbnd) >> 1;
  val[now] = calc(ubnd, dbnd);
  if (ubnd == dbnd) {
    ans[now] = val[now];
    return;
  }
  if (x <= mid)
    work((now << 1), ubnd, mid, x);
  else
    work((now << 1 | 1), mid + 1, dbnd, x);
  ans[now] = max(val[now], max(ans[(now << 1)], ans[(now << 1 | 1)]));
}
int getans(int x, int y) {
  s[x][y] = 1;
  for (int i = 1; i <= N; ++i) {
    u[i][y] = (s[i][y] == 1 ? 0 : u[i - 1][y] + 1);
  }
  for (int i = N; i >= 1; --i) {
    d[i][y] = (s[i][y] == 1 ? 0 : d[i + 1][y] + 1);
  }
  work(1, 1, N, x);
  return ans[1];
}
void solve() {
  build(1, 1, N);
  while (K--) {
    int x, y;
    scanf("%d%d", &x, &y);
    printf("%d\n", getans(x, y));
  }
}
int main() {
  init();
  solve();
  return 0;
}
