#include <bits/stdc++.h>
using namespace std;
const int N = 2020, M = 2020, Changed = -1;
int n, m, k, up[N][M] = {}, down[N][M] = {}, ans[N << 2] = {};
char ch[N][M] = {};
void init() {
  scanf("%d%d%d\n", &n, &m, &k);
  for (int i = 1; i <= n; ++i) scanf("%s\n", ch[i] + 1);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      up[i][j] = ch[i][j] == 'X' ? 0 : up[i - 1][j] + 1;
  for (int i = n; i >= 1; --i)
    for (int j = 1; j <= m; ++j)
      down[i][j] = ch[i][j] == 'X' ? 0 : down[i + 1][j] + 1;
  fill(ans, ans + (N << 2), Changed);
}
void divide_and_conquer(int l, int r, int k) {
  if (ans[k] != Changed) return;
  if (l == r) {
    bool flag = false;
    for (int j = 1; j <= m; ++j) flag |= ch[l][j] == '.';
    ans[k] = flag;
    return;
  }
  int mid = (l + r) >> 1;
  for (int j = 1; j <= m; ++j) {
    up[mid][j] = min(up[mid][j], mid - l + 1);
    down[mid + 1][j] = min(down[mid + 1][j], r - mid);
  }
  divide_and_conquer(l, mid, k << 1);
  divide_and_conquer(mid + 1, r, (k << 1) + 1);
  ans[k] = max(ans[k << 1], ans[(k << 1) + 1]);
  int q1[M] = {}, h1 = 1, t1 = 0, q2[M] = {0}, h2 = 1, t2 = 0, pos = 1;
  for (int j = 1; j <= m; ++j) {
    while (pos == j || pos - j <= up[mid][q1[h1]] + down[mid + 1][q2[h2]]) {
      ans[k] = max(ans[k], pos - j);
      while (h1 <= t1 && up[mid][pos] <= up[mid][q1[t1]]) --t1;
      q1[++t1] = pos;
      while (h2 <= t2 && down[mid + 1][pos] <= down[mid + 1][q2[t2]]) --t2;
      q2[++t2] = pos;
      ++pos;
    }
    if (q1[h1] == j) ++h1;
    if (q2[h2] == j) ++h2;
  }
}
void work() {
  divide_and_conquer(1, n, 1);
  int x, y;
  while (k--) {
    scanf("%d%d", &x, &y);
    ch[x][y] = 'X';
    for (int i = 1; i <= n; ++i)
      up[i][y] = ch[i][y] == 'X' ? 0 : up[i - 1][y] + 1;
    for (int i = n; i >= 1; --i)
      down[i][y] = ch[i][y] == 'X' ? 0 : down[i + 1][y] + 1;
    int l = 1, r = n, k = 1;
    ans[k] = Changed;
    while (l != r) {
      int mid = (l + r) >> 1;
      if (x <= mid)
        k <<= 1, r = mid;
      else
        (k <<= 1) += 1, l = mid + 1;
      ans[k] = Changed;
    }
    divide_and_conquer(1, n, 1);
    printf("%d\n", ans[1]);
  }
}
int main() {
  init();
  work();
  return 0;
}
