#include <bits/stdc++.h>
using namespace std;
bool __hack = std::ios::sync_with_stdio(false);
auto __hack1 = cin.tie(nullptr);
template <class T>
T next(istream& in) {
  T ret;
  in >> ret;
  return ret;
}
const int MAXN = 2004;
bool f[MAXN][MAXN];
int max_len[2][MAXN][MAXN];
int best;
int n, m;
void UpdateRow(int row) {
  max_len[0][row][0] = (int)f[row][0];
  max_len[1][row][m - 1] = (int)f[row][m - 1];
  for (int col = 0; col < (m); ++col)
    if (col > 0) {
      if (f[row][col]) {
        max_len[0][row][col] = max_len[0][row][col - 1] + 1;
      } else {
        max_len[0][row][col] = 0;
      }
      int ncol = m - col - 1;
      if (f[row][ncol]) {
        max_len[1][row][ncol] = max_len[1][row][ncol + 1] + 1;
      } else {
        max_len[1][row][ncol] = 0;
      }
    }
}
struct MinQueue {
  int q[MAXN];
  int dir;
  int col;
  int q_size;
  int q_front;
  int min;
  MinQueue() {}
  MinQueue(int dir_, int col_) {
    this->dir = dir_;
    this->col = col_;
    min = 0;
    q_size = 0;
    q_front = 0;
  }
  void Add(int id) {
    int len = max_len[dir][id][col];
    while (q_size > q_front) {
      int back_len = max_len[dir][q[q_size - 1]][col];
      if (back_len >= len) {
        --q_size;
      } else {
        break;
      }
    }
    q[q_size++] = id;
    min = max_len[dir][q[q_front]][col];
  }
  void RemoveFromQueue(int id) {
    if (q[q_front] == id) {
      ++q_front;
      min = max_len[dir][q[q_front]][col];
    }
  }
};
MinQueue q_left;
MinQueue q_right;
int prev_best;
int X1, Y1, X2;
inline int calc_min(int m1, int m2) {
  if (m1 == 0 || m2 == 0) return 0;
  return m1 + m2 - 1;
}
void SolveOneDimention(int col) {
  int ptr2 = 0;
  q_left = MinQueue(0, col);
  q_right = MinQueue(1, col);
  q_left.Add(0);
  q_right.Add(0);
  for (int ptr1 = 0; ptr1 < (n); ++ptr1) {
    if (ptr2 < ptr1) {
      ptr2 = ptr1;
      q_left.Add(ptr1);
      q_right.Add(ptr1);
    }
    int cur_len = ptr2 - ptr1 + 1;
    int cur_min = calc_min(q_left.min, q_right.min);
    int mm = min(cur_len, cur_min);
    if (best < mm) {
      X1 = ptr1;
      X2 = ptr2;
      Y1 = col - q_left.min + 1;
      best = mm;
    }
    if (best == prev_best) return;
    while (ptr2 < n - 1) {
      if (cur_len < cur_min) {
        ++ptr2;
        q_left.Add(ptr2);
        q_right.Add(ptr2);
        cur_min = calc_min(q_left.min, q_right.min);
        ++cur_len;
        mm = min(cur_len, cur_min);
        if (best < mm) {
          X1 = ptr1;
          X2 = ptr2;
          Y1 = col - q_left.min + 1;
          best = mm;
        }
        if (best == prev_best) return;
      } else {
        break;
      }
    }
    if (n - ptr1 < best) {
      return;
    }
    q_left.RemoveFromQueue(ptr1);
    q_right.RemoveFromQueue(ptr1);
  }
}
void rec(int y1, int y2) {
  if (best == prev_best) {
    return;
  }
  if (y2 - y1 + 1 < best) {
    return;
  }
  if (y2 - y1 == 0) {
    best = 1;
    return;
  }
  int middle = (y1 + y2) / 2;
  SolveOneDimention(middle);
  rec(y1, middle);
  rec(middle + 1, y2);
}
void solve(istream& in, ostream& out) {
  n = next<int>(in);
  m = next<int>(in);
  int count_empty = 0;
  int count_q = next<int>(in);
  for (int i = 0; i < (n); ++i) {
    string s = next<string>(in);
    for (int j = 0; j < (m); ++j) {
      f[i][j] = (s[j] != 'X');
      if (f[i][j]) ++count_empty;
    }
  }
  X1 = -1;
  for (int row = 0; row < (n); ++row) UpdateRow(row);
  prev_best = n * m;
  while (count_q--) {
    int x = next<int>(in) - 1;
    int y = next<int>(in) - 1;
    f[x][y] = false;
    --count_empty;
    UpdateRow(x);
    if (X1 != -1) {
      if (x < X1 || x > X2) {
        if (y < Y1 || y > Y1 + (X2 - X1 + 1) - 1) {
          out << best << endl;
          continue;
        }
      }
    }
    best = 0;
    if (count_empty) {
      rec(0, m - 1);
    }
    out << best << endl;
    prev_best = best;
  }
}
int main() {
  solve(cin, cout);
  return 0;
}
