#include <bits/stdc++.h>
using namespace std;
int min(int a, int b) {
  if (a < b) return a;
  return b;
}
int max(int a, int b) {
  if (a > b) return a;
  return b;
}
const int bitslimite = 11;
const int limite = 1 << bitslimite;
short int up[limite][limite], down[limite][limite], ri[limite][limite],
    le[limite][limite];
short int valor[limite][limite];
short int calculo[limite][limite][bitslimite + 1];
int indice1[limite], indice2[limite], h1[limite], h2[limite];
int k1, k2, kk1, kk2;
void arreglak() {
  while (k1 > 0 and h1[k1 - 1] >= h1[k1]) {
    h1[k1 - 1] = h1[k1];
    indice1[k1 - 1] = indice1[k1];
    k1--;
  }
  kk1 = min(kk1, k1);
  while (k2 > 0 and h2[k2 - 1] >= h2[k2]) {
    h2[k2 - 1] = h2[k2];
    indice2[k2 - 1] = indice2[k2];
    k2--;
  }
  kk2 = min(kk2, k2);
}
int fusiona(int i1, int i2, int j1, int j2) {
  int n = (i2 - i1);
  int n2 = n / 2;
  int sol = 0;
  k1 = -1;
  k2 = -1;
  kk1 = 0;
  kk2 = 0;
  int jj = 0;
  for (int j = 0; j < n; j++) {
    k1++;
    h1[k1] = min(n2, up[i1 + n2 - 1][j1 + j]);
    indice1[k1] = j;
    k2++;
    h2[k2] = min(n2, down[i1 + n2][j1 + j]);
    indice2[k2] = j;
    arreglak();
    for (;;) {
      if (jj == j) break;
      int nextd1 = h1[kk1];
      if (kk1 < k1 and jj == indice1[kk1]) nextd1 = h1[kk1 + 1];
      int nextd2 = h2[kk2];
      if (kk2 < k2 and jj == indice2[kk2]) nextd2 = h2[kk2 + 1];
      if (nextd1 + nextd2 > j - jj) break;
      if (indice1[kk1] == jj) kk1++;
      if (indice2[kk2] == jj) kk2++;
      jj++;
    }
    int d1 = h1[kk1];
    int d2 = h2[kk2];
    sol = max(sol, min(d1 + d2, j - jj + 1));
    if (jj < j) {
      int nextd1 = h1[kk1];
      if (kk1 < k1 and jj == indice1[kk1]) nextd1 = h1[kk1 + 1];
      int nextd2 = h2[kk2];
      if (kk2 < k2 and jj == indice2[kk2]) nextd2 = h2[kk2 + 1];
      sol = max(sol, min(nextd1 + nextd2, j - jj));
    }
  }
  k1 = -1;
  k2 = -1;
  kk1 = 0;
  kk2 = 0;
  int ii = 0;
  for (int i = 0; i < n; i++) {
    k1++;
    h1[k1] = min(n2, le[i1 + i][j1 + n2 - 1]);
    indice1[k1] = i;
    k2++;
    h2[k2] = min(n2, ri[i1 + i][j1 + n2]);
    indice2[k2] = i;
    arreglak();
    for (;;) {
      if (ii == i) break;
      int nextd1 = h1[kk1];
      if (kk1 < k1 and ii == indice1[kk1]) nextd1 = h1[kk1 + 1];
      int nextd2 = h2[kk2];
      if (kk2 < k2 and ii == indice2[kk2]) nextd2 = h2[kk2 + 1];
      if (nextd1 + nextd2 > i - ii) break;
      if (indice1[kk1] == ii) kk1++;
      if (indice2[kk2] == ii) kk2++;
      ii++;
    }
    int d1 = h1[kk1];
    int d2 = h2[kk2];
    sol = max(sol, min(d1 + d2, i - ii + 1));
    if (ii < i) {
      int nextd1 = h1[kk1];
      if (kk1 < k1 and ii == indice1[kk1]) nextd1 = h1[kk1 + 1];
      int nextd2 = h2[kk2];
      if (kk2 < k2 and ii == indice2[kk2]) nextd2 = h2[kk2 + 1];
      sol = max(sol, min(nextd1 + nextd2, i - ii));
    }
  }
  return sol;
}
void calculabis(int i1, int i2, int j1, int j2) {
  int n = (i2 - i1);
  int b = __builtin_ctz(n);
  short int &c = calculo[i1][j1][b];
  int n2 = n / 2;
  c = max(
      max(max(calculo[i1][j1][b - 1], calculo[i1][j1 + n2][b - 1]),
          max(calculo[i1 + n2][j1][b - 1], calculo[i1 + n2][j1 + n2][b - 1])),
      fusiona(i1, i2, j1, j2));
}
void calcula(int i1, int i2, int j1, int j2) {
  int n = (i2 - i1);
  int b = __builtin_ctz(n);
  short int &c = calculo[i1][j1][b];
  if (n == 1) {
    c = valor[i1][j1] == 0;
    return;
  }
  int n2 = n / 2;
  calcula(i1, i1 + n2, j1, j1 + n2);
  calcula(i1, i1 + n2, j1 + n2, j2);
  calcula(i1 + n2, i2, j1, j1 + n2);
  calcula(i1 + n2, i2, j1 + n2, j2);
  calculabis(i1, i2, j1, j2);
}
void modifica(int i1, int i2, int j1, int j2, int i, int j) {
  int n = (i2 - i1);
  int b = __builtin_ctz(n);
  short int &c = calculo[i1][j1][b];
  if (n == 1) {
    c = valor[i1][j1] == 0;
    return;
  }
  int n2 = n / 2;
  if (i < i1 + n2) {
    if (j < j1 + n2)
      modifica(i1, i1 + n2, j1, j1 + n2, i, j);
    else
      modifica(i1, i1 + n2, j1 + n2, j2, i, j);
  } else {
    if (j < j1 + n2)
      modifica(i1 + n2, i2, j1, j1 + n2, i, j);
    else
      modifica(i1 + n2, i2, j1 + n2, j2, i, j);
  }
  calculabis(i1, i2, j1, j2);
}
int main() {
  ios::sync_with_stdio(false);
  int n, m, casos;
  cin >> n >> m >> casos;
  for (int i = 0; i < limite; i++)
    for (int j = 0; j < limite; j++) valor[i][j] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      char c;
      cin >> c;
      valor[i][j] = c == 'X';
    }
  }
  for (int i = 0; i < limite; i++) {
    for (int j = 0; j < limite; j++)
      if (valor[i][j] == 0) le[i][j] = le[i][j - 1] + 1;
    for (int j = limite - 1; j >= 0; j--)
      if (valor[i][j] == 0) ri[i][j] = ri[i][j + 1] + 1;
  }
  for (int j = 0; j < limite; j++) {
    for (int i = 0; i < limite; i++)
      if (valor[i][j] == 0) up[i][j] = up[i - 1][j] + 1;
    for (int i = limite - 1; i >= 0; i--)
      if (valor[i][j] == 0) down[i][j] = down[i + 1][j] + 1;
  }
  calcula(0, limite, 0, limite);
  for (int cas = 0; cas < casos; cas++) {
    int ii, jj;
    cin >> ii >> jj;
    valor[ii][jj] = 1;
    up[ii][jj] = down[ii][jj] = ri[ii][jj] = le[ii][jj] = 0;
    for (int j = jj - 1; j >= 0 and ri[ii][j]; j--) ri[ii][j] = jj - j;
    for (int j = jj + 1; j < limite and le[ii][j]; j++) le[ii][j] = j - jj;
    for (int i = ii - 1; i >= 0 and down[i][jj]; i--) down[i][jj] = ii - i;
    for (int i = ii + 1; i < limite and up[i][jj]; i++) up[i][jj] = i - ii;
    modifica(0, limite, 0, limite, ii, jj);
    cout << calculo[0][0][bitslimite] << endl;
  }
}
