#include <bits/stdc++.h>
using namespace std;
char maze[2005][2005];
int up[2005][2005], down[2005][2005];
pair<int, int> po[2005];
int n, m;
inline void solve_col(int c) {
  if (maze[1][c] == 'X')
    up[1][c] = 1;
  else
    up[1][c] = 0;
  for (int i = 2; i <= n; ++i) {
    if (maze[i][c] == 'X')
      up[i][c] = i;
    else
      up[i][c] = up[i - 1][c];
  }
  if (maze[n][c] == 'X')
    down[n][c] = n;
  else
    down[n][c] = n + 1;
  for (int i = n - 1; i >= 1; --i) {
    if (maze[i][c] == 'X')
      down[i][c] = i;
    else
      down[i][c] = down[i + 1][c];
  }
}
int sum[2005][2005];
inline int cal(int x, int y) {
  int l = 1, r = min(x, y), mid, res = 0;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (sum[x][y] - sum[x - mid][y] - sum[x][y - mid] + sum[x - mid][y - mid])
      r = mid - 1;
    else {
      res = mid;
      l = mid + 1;
    }
  }
  return res;
}
inline int get_init() {
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      sum[i][j] = sum[i][j - 1] + sum[i - 1][j] - sum[i - 1][j - 1] +
                  (maze[i][j] == 'X');
  int res = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) res = max(res, cal(i, j));
  return res;
}
struct Max_que {
  int r, fr, re, que[2005];
  inline void init(int _r) {
    r = _r;
    fr = re = 0;
  }
  inline void add(int c) {
    while (fr != re && up[r][que[re - 1]] <= up[r][c]) --re;
    que[re++] = c;
  }
  inline int read(int sz, int c) {
    while (fr != re && que[fr] + sz - 1 < c) ++fr;
    return up[r][que[fr]];
  }
} max_q;
struct Min_que {
  int r, fr, re, que[2005];
  inline void init(int _r) {
    r = _r;
    fr = re = 0;
  }
  inline void add(int c) {
    while (fr != re && down[r][que[re - 1]] >= down[r][c]) --re;
    que[re++] = c;
  }
  inline int read(int sz, int c) {
    while (fr != re && que[fr] + sz - 1 < c) ++fr;
    return down[r][que[fr]];
  }
} min_q;
inline bool have(int sz, int x, int y) {
  int l = max(1, y - sz + 1), r = min(m, y + sz - 1);
  max_q.init(x);
  min_q.init(x);
  for (int i = l; i <= r; ++i) {
    max_q.add(i);
    min_q.add(i);
    if (i - l + 1 < sz) continue;
    if (min_q.read(sz, i) - max_q.read(sz, i) - 1 >= sz) return 1;
  }
  return 0;
}
int ans[2005];
int main() {
  int q;
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; ++i) scanf("%s", maze[i] + 1);
  for (int i = 0; i < q; ++i) {
    scanf("%d%d", &po[i].first, &po[i].second);
    maze[po[i].first][po[i].second] = 'X';
  }
  for (int i = 1; i <= m; ++i) solve_col(i);
  int res = get_init();
  for (int i = q - 1; i >= 0; --i) {
    ans[i] = res;
    maze[po[i].first][po[i].second] = '.';
    solve_col(po[i].second);
    for (int j = res + 1; j <= min(n, m); ++j) {
      if (have(j, po[i].first, po[i].second))
        res = j;
      else
        break;
    }
  }
  for (int i = 0; i < q; ++i) printf("%d\n", ans[i]);
  return 0;
}
