#include <bits/stdc++.h>
using namespace std;
struct Que {
  int x, y;
} q[2010];
char a[2010][2010];
int l[2010][2010], r[2010][2010], n, m;
stack<int> st, Ans;
int ans = 0;
int tmp[2020];
void work(int x) {
  while (st.size()) st.pop();
  memset(tmp, 0, sizeof(tmp));
  r[n + 1][x] = 0;
  for (int i = 1; i <= n + 1; i++) {
    while (st.size() && r[st.top()][x] >= r[i][x]) {
      ans = max(ans, min(i - tmp[st.top()], r[st.top()][x]));
      st.pop();
    }
    if (st.size())
      tmp[i] = st.top() + 1;
    else
      tmp[i] = 1;
    st.push(i);
  }
}
deque<int> qu;
bool check(int lim, int x) {
  memset(tmp, 0, sizeof(tmp));
  qu.clear();
  for (int i = 1; i <= n; i++) {
    while (qu.size() && r[qu.back()][x] >= r[i][x]) qu.pop_back();
    qu.push_back(i);
    while (qu.size() && qu.front() <= i - lim) qu.pop_front();
    tmp[i] = r[qu.front()][x];
  }
  qu.clear();
  for (int i = 1; i <= n; i++) {
    while (qu.size() && l[qu.back()][x] >= l[i][x]) qu.pop_back();
    qu.push_back(i);
    while (qu.size() && qu.front() <= i - lim) qu.pop_front();
    tmp[i] += l[qu.front()][x] - 1;
  }
  for (int i = lim; i <= n; i++) {
    if (tmp[i] >= lim) return 1;
  }
  return 0;
}
int main() {
  int Q;
  scanf("%d%d%d", &n, &m, &Q);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf(" %c", &a[i][j]);
  for (int i = 1; i <= Q; i++) {
    scanf("%d%d", &q[i].x, &q[i].y);
    a[q[i].x][q[i].y] = 'X';
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (a[i][j] != 'X')
        l[i][j] = l[i][j - 1] + 1;
      else
        l[i][j] = 0;
    }
    for (int j = m; j > 0; j--) {
      if (a[i][j] != 'X')
        r[i][j] = r[i][j + 1] + 1;
      else
        r[i][j] = 0;
    }
  }
  for (int i = 1; i <= m; i++) {
    work(i);
  }
  Ans.push(ans);
  while (Q > 1) {
    int x = q[Q].x, y = q[Q].y;
    a[x][y] = '.';
    l[x][y] = l[x][y - 1] + 1;
    r[x][y] = r[x][y + 1] + 1;
    for (int i = y + 1; i <= m; i++) {
      if (a[x][i] == 'X') break;
      l[x][i] += l[x][y];
    }
    for (int i = y - 1; i > 0; i--) {
      if (a[x][i] == 'X') break;
      r[x][i] += r[x][y];
    }
    for (; ans + 1 <= n && check(ans + 1, y); ++ans)
      ;
    --Q;
    Ans.push(ans);
  }
  while (Ans.size()) printf("%d\n", Ans.top()), Ans.pop();
}
