#include <bits/stdc++.h>
using namespace std;
const int MAX = 2005;
char t[MAX][MAX];
int le[MAX][MAX], ri[MAX][MAX];
int x[MAX], y[MAX], ans[MAX], n, m, q;
int d1[MAX], d2[MAX];
void calc(int r) {
  if (t[r][0] == '.')
    le[r][0] = 1;
  else
    le[r][0] = 0;
  for (int i = 1; i < m; i++)
    if (t[r][i] == 'X')
      le[r][i] = 0;
    else
      le[r][i] = le[r][i - 1] + 1;
  if (t[r][m - 1] == '.')
    ri[r][m - 1] = 1;
  else
    ri[r][m - 1] = 0;
  for (int i = m - 2; i >= 0; i--)
    if (t[r][i] == 'X')
      ri[r][i] = 0;
    else
      ri[r][i] = ri[r][i + 1] + 1;
}
bool can(int c, int k) {
  if (k > min(n, m)) return false;
  int h1 = 0, t1 = 0, h2 = 0, t2 = 0;
  for (int i = 0; i < n; i++) {
    while (t1 - h1 > 0 && le[d1[t1 - 1]][c] > le[i][c]) t1--;
    d1[t1++] = i;
    while (d1[h1] <= i - k) h1++;
    while (t2 - h2 > 0 && ri[d2[t2 - 1]][c] > ri[i][c]) t2--;
    d2[t2++] = i;
    while (d2[h2] <= i - k) h2++;
    if (i >= k - 1 && le[d1[h1]][c] + ri[d2[h2]][c] - 1 >= k) return true;
  }
  return false;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m >> q;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> t[i][j];
  for (int i = 0; i < q; i++) {
    cin >> x[i] >> y[i];
    x[i]--;
    y[i]--;
    t[x[i]][y[i]] = 'X';
  }
  for (int i = 0; i < n; i++) calc(i);
  int res = 0;
  for (int i = 0; i < m; i++)
    while (can(i, res + 1)) res++;
  for (int i = q - 1; i >= 0; i--) {
    ans[i] = res;
    t[x[i]][y[i]] = '.';
    calc(x[i]);
    while (can(y[i], res + 1)) res++;
  }
  for (int i = 0; i < q; i++) cout << ans[i] << "\n";
  return 0;
}
