#include <bits/stdc++.h>
using namespace std;
const int maxN = 2e3 + 5;
const int INF = 0x3f3f3f3f;
int up[maxN][maxN];
int down[maxN][maxN];
char s[maxN][maxN];
int N, M, K;
int Ans[4 * maxN];
void init() {
  scanf("%d%d%d\n", &N, &M, &K);
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= M; j++) s[i][j] = getchar();
    getchar();
  }
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= M; j++) {
      if (s[i][j] == '.')
        up[i][j] = up[i - 1][j] + 1;
      else
        up[i][j] = 0;
    }
  }
  for (int i = N; i >= 1; i--) {
    for (int j = 1; j <= M; j++) {
      if (s[i][j] == '.')
        down[i][j] = down[i + 1][j] + 1;
      else
        down[i][j] = 0;
    }
  }
}
void update(int x, int y) {
  s[x][y] = 'X';
  for (int i = 1; i <= N; i++) {
    if (s[i][y] != 'X')
      up[i][y] = up[i - 1][y] + 1;
    else
      up[i][y] = 0;
  }
  for (int i = N; i >= 1; i--) {
    if (s[i][y] != 'X')
      down[i][y] = down[i + 1][y] + 1;
    else
      down[i][y] = 0;
  }
}
struct Deque {
  int head, tail;
  int q[maxN];
  Deque() {}
  void init() { head = tail = 0; }
  int front() {
    if (head == tail) return 0;
    return q[head];
  }
  void pop(int v) {
    if (v == q[head]) head++;
  }
  void push(int v) {
    for (; q[tail - 1] > v && tail != head; --tail) {
    }
    q[tail++] = v;
  }
};
Deque uq, dq;
int get_ans(int l, int r, int now) {
  if (Ans[now] != -1) return Ans[now];
  if (l + 1 == r) {
    for (int i = 1; i <= M; i++)
      if (s[l][i] == '.') return Ans[now] = 1;
    return Ans[now] = 0;
  }
  int mid = (l + r) >> 1;
  Ans[now] = max(get_ans(l, mid, now << 1), get_ans(mid, r, (now << 1) + 1));
  int L = 1, R = 1;
  uq.init();
  dq.init();
  while (L <= M) {
    if (R - L > uq.front() + dq.front()) {
      uq.pop(min(mid - l, up[mid - 1][L]));
      dq.pop(min(r - mid, down[mid][L]));
      L++;
    } else {
      Ans[now] = max(Ans[now], R - L);
      uq.push(min(mid - l, up[mid - 1][R]));
      dq.push(min(r - mid, down[mid][R]));
      R++;
    }
  }
  return Ans[now];
}
void solve() {
  memset(Ans, -1, sizeof(Ans));
  get_ans(1, N + 1, 1);
  for (int i = 1; i <= K; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    update(x, y);
    int l = 1, r = N + 1, now = 1;
    Ans[now] = -1;
    while (l + 1 != r) {
      int mid = (l + r) / 2;
      if (mid > x) {
        now = now * 2;
        r = mid;
      } else {
        now = now * 2 + 1;
        l = mid;
      }
      Ans[now] = -1;
    }
    printf("%d\n", get_ans(1, N + 1, 1));
  }
}
int main() {
  init();
  solve();
  return 0;
}
