#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
struct debugger {
  template <typename T>
  debugger &operator,(const T &v) {
    cerr << v << " ";
    return *this;
  }
} dbg;
struct Point {
  int x, y, ans;
} p[2000 + 10];
bool a[2000 + 10][2000 + 10];
int f[2000 + 10][2000 + 10];
int l[2000 + 10][2000 + 10], r[2000 + 10][2000 + 10];
int n, m, q;
bool check(int x, int y, int ans) {
  int top = x - 1;
  static int ll[2000 + 10], rr[2000 + 10];
  memset(ll, 0, sizeof(ll));
  memset(rr, 0x7f, sizeof(rr));
  ll[x] = l[x][y];
  rr[x] = r[x][y];
  for (; top >= 1; --top) {
    ll[top] = max(ll[top + 1], l[top][y]);
    rr[top] = min(rr[top + 1], r[top][y]);
    if (rr[top] - ll[top] + 1 - 2 < ans) break;
  }
  ++top;
  int bottom = x + 1;
  for (; bottom <= n; ++bottom) {
    ll[bottom] = max(ll[bottom - 1], l[bottom][y]);
    rr[bottom] = min(rr[bottom - 1], r[bottom][y]);
    if (rr[bottom] - ll[bottom] + 1 - 2 < ans) break;
  }
  --bottom;
  for (int i = top; i + ans - 1 <= bottom; ++i) {
    if (min(rr[i], rr[i + ans - 1]) - max(ll[i], ll[i + ans - 1]) - 1 >= ans)
      return true;
  }
  return false;
}
int main() {
  memset(a, false, sizeof(a));
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      char t;
      do t = getchar();
      while (t != '.' && t != 'X');
      a[i][j] = (t == '.');
    }
  }
  for (int i = 1; i <= q; ++i) {
    scanf("%d%d", &p[i].x, &p[i].y);
    a[p[i].x][p[i].y] = false;
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (a[i][j]) {
        f[i][j] = min(f[i - 1][j - 1], min(f[i - 1][j], f[i][j - 1])) + 1;
        ans = max(ans, f[i][j]);
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    l[i][0] = 0;
    for (int j = 1; j <= m; ++j) {
      if (a[i][j]) {
        l[i][j] = l[i][j - 1];
      } else {
        l[i][j] = j;
      }
    }
    r[i][m + 1] = m + 1;
    for (int j = m; j >= 1; --j) {
      if (a[i][j]) {
        r[i][j] = r[i][j + 1];
      } else {
        r[i][j] = j;
      }
    }
  }
  p[q].ans = ans;
  for (int i = q; i >= 2; --i) {
    int x = p[i].x, y = p[i].y;
    a[x][y] = true;
    l[x][y] = l[x][y - 1];
    for (int j = y + 1; j <= m; ++j) {
      if (a[x][j]) {
        l[x][j] = l[x][j - 1];
      } else
        break;
    }
    r[x][y] = r[x][y + 1];
    for (int j = y - 1; j >= 1; --j) {
      if (a[x][j]) {
        r[x][j] = r[x][j + 1];
      } else
        break;
    }
    while (check(x, y, ans + 1)) ++ans;
    p[i - 1].ans = ans;
  }
  for (int i = 1; i <= q; ++i) {
    printf("%d\n", p[i].ans);
  }
  return 0;
}
