#include <bits/stdc++.h>
using namespace std;
int down[2005][2005];
int up[2005][2005];
char arr[2005][2005];
int xrmq[2004][20];
int mrmq[2004][20];
int n, m, i, k, j, x, y, z;
int ans[2005];
vector<pair<int, int> > a;
vector<int> v;
void g1(int j) {
  int i;
  for (i = 1; i <= n; i++) {
    up[i][j] = up[i - 1][j];
    if (arr[i][j] == 'X') up[i][j] = i;
  }
}
void g2(int j) {
  int i;
  for (i = n; i >= 1; i--) {
    down[i][j] = down[i + 1][j];
    if (arr[i][j] == 'X') down[i][j] = i;
    if (i == n and arr[i][j] == '.') down[i][j] = n + 1;
  }
}
int fm(int x, int y) {
  int t = log2(y - x + 1);
  return min(mrmq[x][t], mrmq[y - (1 << t) + 1][t]);
}
int fx(int x, int y) {
  int t = log2(y - x + 1);
  return max(xrmq[x][t], xrmq[y - (1 << t) + 1][t]);
}
int f(int x) {
  int l, r, j, i, t = 0;
  r = l = 1;
  for (i = 1; i <= m; i++) {
    mrmq[i][0] = down[x][i];
    xrmq[i][0] = up[x][i];
  }
  for (j = 1; j <= 10; j++)
    for (i = 1; i <= m; i++)
      mrmq[i][j] = min(mrmq[i][j - 1], mrmq[min(m, i + (1 << (j - 1)))][j - 1]);
  for (j = 1; j <= 10; j++)
    for (i = 1; i <= m; i++)
      xrmq[i][j] = max(xrmq[i][j - 1], xrmq[min(m, i + (1 << (j - 1)))][j - 1]);
  j = 1;
  for (i = 1; i <= m; i++) {
    j = max(j, i);
    while (fm(i, j) - fx(i, j) - 1 >= j - i + 1 and j <= m) {
      j++;
      t = max(j - i, t);
    }
  }
  return ans[x] = t;
}
int main() {
  cin >> n >> m >> k;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) scanf(" %c", &arr[i][j]);
  for (i = 1; i <= k; i++) {
    cin >> x >> y;
    a.push_back(make_pair(x, y));
    arr[x][y] = 'X';
  }
  for (j = 1; j <= m; j++) g1(j);
  for (j = m; j >= 1; j--) g2(j);
  for (i = 1; i <= n; i++) {
    ans[i] = f(i);
  }
  for (i = k - 1; i >= 0; i--) {
    v.push_back(*max_element(ans + 1, ans + 1 + n));
    arr[a[i].first][a[i].second] = '.';
    g1(a[i].second);
    g2(a[i].second);
    f(a[i].first);
  }
  for (i = v.size() - 1; i >= 0; i--) {
    cout << v[i] << '\n';
  }
}
