#include <bits/stdc++.h>
using namespace std;
int n, k, m, q[2123], q1[2123], d[2123], a[2123][2123], mi, c[2][2123][2123], s;
char ch;
struct d {
  int h, r, mn[2123];
  void cl() { h = 1, r = 0; }
  void ad(int e, int j, int fg) {
    while (h <= r && c[fg][e][mn[r]] >= c[fg][e][j]) --r;
    mn[++r] = j;
  }
  void del(int j) {
    while (h <= r && j - mn[h] >= mi) ++h;
  }
} st[2];
bool ck(int e) {
  st[0].cl();
  st[1].cl();
  for (int j = 1; j <= mi - 1; j++) st[0].ad(e, j, 1), st[1].ad(e + 1, j, 0);
  for (int j = mi; j <= n; j++) {
    st[0].del(j);
    st[1].del(j);
    st[0].ad(e, j, 1);
    st[1].ad(e + 1, j, 0);
    if (c[1][e][st[0].mn[st[0].h]] + c[0][e + 1][st[1].mn[st[1].h]] >= mi)
      return 1;
  }
  return 0;
}
void gx(int e) {
  int ll = mi = s + 1, rr = min(m, n);
  if (ll > rr || !ck(e)) return;
  while (ll < rr) {
    mi = ll + rr + 1 >> 1;
    if (ck(e))
      ll = mi;
    else
      rr = mi - 1;
  }
  s = ll;
}
signed main() {
  scanf("%d%d%d", &m, &n, &k);
  int j;
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= n; j++) {
      cin >> ch;
      a[i][j] = (ch == 'X');
    }
  for (int i = 1; i <= k; i++) scanf("%d%d", &q[i], &q1[i]), a[q[i]][q1[i]] = 1;
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= n; j++) c[0][i][j] = a[i][j] ^ 1;
  for (int i = 2; i <= m; i++)
    for (int j = 2; j <= n; j++)
      c[0][i][j] =
          c[0][i][j]
              ? min(min(c[0][i - 1][j], c[0][i][j - 1]), c[0][i - 1][j - 1]) + 1
              : 0;
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= n; j++) s = max(s, c[0][i][j]);
  d[k] = s;
  for (int j = 1; j <= n; j++)
    for (int i = 1; i <= m; i++)
      c[1][i][j] = (a[i][j] ? 0 : 1 + c[1][i - 1][j]);
  for (int j = 1; j <= n; j++)
    for (int i = m; i >= 1; i--)
      c[0][i][j] = (a[i][j] ? 0 : 1 + c[0][i + 1][j]);
  for (int l = k; l >= 2; l--) {
    a[q[l]][j = q1[l]] = 0;
    for (int i = 1; i <= m; i++)
      c[1][i][j] = (a[i][j] ? 0 : 1 + c[1][i - 1][j]);
    for (int i = m; i >= 1; i--)
      c[0][i][j] = (a[i][j] ? 0 : 1 + c[0][i + 1][j]);
    gx(q[l]), d[l - 1] = s;
  }
  for (int i = 1; i <= k; i++) printf("%d\n", d[i]);
  return 0;
}
