#include <bits/stdc++.h>
using namespace std;
int read() {
  bool f = 0;
  int x = 0;
  char c = getchar();
  while (c < '0' || '9' < c) {
    if (c == '-') f = 1;
    c = getchar();
  }
  while ('0' <= c && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  return !f ? x : -x;
}
char S[2000 + 5][2000 + 5];
int m, high[2000 + 5][2000 + 5], low[2000 + 5][2000 + 5];
int Q[2000 + 5], X[2000 + 5], Y[2000 + 5], Ans[2000 + 5], a[2000 + 5];
bool check(int row, int len) {
  int head = 1, tail = 0;
  for (int j = 1; j <= m; j++) {
    while (head <= tail && high[row][Q[tail]] >= high[row][j]) tail--;
    Q[++tail] = j;
    while (Q[head] + len <= j) head++;
    a[j] = high[row][Q[head]];
  }
  head = 1, tail = 0;
  for (int j = 1; j <= m; j++) {
    while (head <= tail && low[row][Q[tail]] >= low[row][j]) tail--;
    Q[++tail] = j;
    while (Q[head] + len <= j) head++;
    a[j] += low[row][Q[head]] - 1;
  }
  for (int j = len; j <= m; j++)
    if (a[j] >= len) return 1;
  return 0;
}
int f[2000 + 5][2000 + 5];
int main() {
  int n = read();
  m = read();
  int q = read();
  for (int i = 1; i <= n; i++) scanf("%s", S[i] + 1);
  for (int i = 1; i <= q; i++) {
    X[i] = read(), Y[i] = read();
    S[X[i]][Y[i]] = 'X';
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (S[i][j] == 'X')
        high[i][j] = 0;
      else
        high[i][j] = high[i - 1][j] + 1;
  for (int i = n; i >= 1; i--)
    for (int j = 1; j <= m; j++)
      if (S[i][j] == 'X')
        low[i][j] = 0;
      else
        low[i][j] = low[i + 1][j] + 1;
  int ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      if (S[i][j] == 'X')
        f[i][j] = 0;
      else
        f[i][j] = min(f[i - 1][j], min(f[i][j - 1], f[i - 1][j - 1])) + 1;
      ans = max(ans, f[i][j]);
    }
  for (int t = q; t >= 1; t--) {
    Ans[t] = ans;
    S[X[t]][Y[t]] = '.';
    for (int i = 1; i <= n; i++)
      if (S[i][Y[t]] == 'X')
        high[i][Y[t]] = 0;
      else
        high[i][Y[t]] = high[i - 1][Y[t]] + 1;
    for (int i = n; i >= 1; i--)
      if (S[i][Y[t]] == 'X')
        low[i][Y[t]] = 0;
      else
        low[i][Y[t]] = low[i + 1][Y[t]] + 1;
    while (check(X[t], ans + 1)) ans++;
  }
  for (int i = 1; i <= q; i++) printf("%d\n", Ans[i]);
  return 0;
}
