#include <bits/stdc++.h>
using namespace std;
inline int in() {
  int x;
  scanf("%d", &x);
  return x;
}
const long double EPS = 1e-12;
const int INF = 1e9 + 10;
const long long LINF = 9000ll * 1000 * 1000 * 1000 * 1000 * 1000 + 100;
const int MN = 2e3 + 10;
int n, m, q;
pair<int, int> qr[MN];
int res = 0;
int ans[MN];
int R[MN][MN], L[MN][MN];
string s[MN];
deque<int> le, ri;
void Add(int f, int id, int id1) {
  if (!f) {
    while (!le.empty() && L[le.back()][id1] <= L[id][id1]) le.pop_back();
    le.push_back(id);
  } else {
    while (!ri.empty() && R[ri.back()][id1] >= R[id][id1]) ri.pop_back();
    ri.push_back(id);
  }
}
bool check(int id, int lim) {
  if (lim > min(n, m)) return false;
  if (lim == 0) return true;
  le.clear(), ri.clear();
  for (int i = 0; i < lim && i < n; ++i) Add(0, i, id), Add(1, i, id);
  int val = R[ri[0]][id] - L[le[0]][id] - 1;
  if (val >= lim) return true;
  for (int i = lim; i < n; ++i) {
    if (le[0] == i - lim) le.pop_front();
    if (ri[0] == i - lim) ri.pop_front();
    Add(0, i, id), Add(1, i, id);
    val = R[ri[0]][id] - L[le[0]][id] - 1;
    if (val >= lim) return true;
  }
  return false;
}
void prep(int id) {
  for (int i = 0; i < m; ++i) {
    if (s[id][i] == 'X')
      L[id][i] = i;
    else {
      if (!i)
        L[id][i] = -1;
      else
        L[id][i] = L[id][i - 1];
    }
  }
  for (int i = m - 1; ~i; --i) {
    if (s[id][i] == 'X')
      R[id][i] = i;
    else {
      if (i == m - 1)
        R[id][i] = m;
      else
        R[id][i] = R[id][i + 1];
    }
  }
}
void input() {
  cin >> n >> m >> q;
  for (int i = 0; i < n; ++i) cin >> s[i];
  for (int i = 0; i < q; ++i) {
    cin >> qr[i].first >> qr[i].second;
    --qr[i].first, --qr[i].second;
    s[qr[i].first][qr[i].second] = 'X';
  }
  for (int i = 0; i < n; ++i) prep(i);
  for (int j = 0; j < m; ++j)
    while (check(j, res + 1)) ++res;
  ans[q - 1] = res;
  for (int i = q - 1; i > 0; --i) {
    s[qr[i].first][qr[i].second] = '.';
    prep(qr[i].first);
    while (check(qr[i].second, res + 1)) ++res;
    ans[i - 1] = res;
  }
}
int main() {
  ios_base ::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  input();
  for (int i = 0; i < q; ++i) cout << ans[i] << '\n';
  return 0;
}
