#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  return x * f;
}
const int N = 2010;
char a[N][N];
int x[N], y[N], L[N], R[N], U[N][N], D[N][N], q1[N], q2[N], ans[N], sk[N];
int Ans, n, m;
void solve() {
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) U[i][j] = a[i][j] == '.' ? U[i - 1][j] + 1 : 0;
  for (int i = n; i >= 1; --i)
    for (int j = 1; j <= m; ++j) D[i][j] = a[i][j] == '.' ? D[i + 1][j] + 1 : 0;
  for (int i = 1; i <= n; ++i) {
    U[i][0] = U[i][m + 1] = -1;
    for (int top = 0, j = 1; j <= m + 1; ++j) {
      while (top > 0 && U[i][j] < U[i][sk[top]]) R[sk[top]] = j, top--;
      sk[++top] = j;
    }
    for (int top = 0, j = m; j >= 0; --j) {
      while (top > 0 && U[i][j] < U[i][sk[top]]) L[sk[top]] = j, top--;
      sk[++top] = j;
    }
    for (int j = 1; j <= m; ++j) Ans = max(Ans, min(U[i][j], R[j] - L[j] - 1));
  }
}
bool update(int x, int k) {
  int L1 = 1, R1 = 0, L2 = 1, R2 = 0;
  for (int j = 1; j <= m; ++j) {
    while (L1 <= R1 && j - q1[L1] + 1 > k) L1++;
    while (L1 <= R1 && U[x][q1[R1]] >= U[x][j]) R1--;
    q1[++R1] = j;
    while (L2 <= R2 && j - q2[L2] + 1 > k) L2++;
    while (L2 <= R2 && D[x][q2[R2]] >= D[x][j]) R2--;
    q2[++R2] = j;
    if (j >= k && U[x][q1[L1]] + D[x][q2[L2]] - 1 >= k) {
      Ans = k;
      return true;
    }
  }
  return false;
}
void Change(int x, int y) {
  a[x][y] = '.';
  for (int i = x; i <= n; ++i) U[i][y] = a[i][y] == '.' ? U[i - 1][y] + 1 : 0;
  for (int i = x; i >= 1; --i) D[i][y] = a[i][y] == '.' ? D[i + 1][y] + 1 : 0;
}
int main() {
  n = read(), m = read();
  int Q = read();
  for (int i = 1; i <= n; ++i) scanf("%s", a[i] + 1);
  for (int i = 1; i <= Q; ++i) {
    x[i] = read(), y[i] = read();
    a[x[i]][y[i]] = 'X';
  }
  solve();
  for (int i = Q; i >= 1; --i) {
    ans[i] = Ans;
    Change(x[i], y[i]);
    while (update(x[i], Ans + 1))
      ;
  }
  for (int i = 1; i <= Q; ++i) printf("%d\n", ans[i]);
  return 0;
}
