#include <iostream>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <assert.h>
#include <stdio.h>

using namespace std;

const int kSize = 160;

typedef pair<int,int> coords;

coords getCoords(const int val) {
  return coords(val/kSize,val%kSize);
}

int getVal(const coords co) {
  return co.first*kSize+co.second;
}

coords north(const coords co) {
  return coords(co.first-1,co.second);
}
coords south(const coords co) {
  return coords(co.first+1,co.second);
}
coords east(const coords co) {
  return coords(co.first,co.second+1);
}
coords west(const coords co) {
  return coords(co.first,co.second-1);
}

coords godir(const coords co, int dir) {
  if (dir < 0) while (dir < 0) dir += 4;
  while (dir >=4 ) dir -= 4;
  if (dir == 0) return north(co);
  if (dir == 1) return east(co);
  if (dir == 2) return south(co);
  if (dir == 3) return west(co);
}

class Grid {
 public:
  static const int origin = kSize*kSize/2 + kSize/2;
  static const int offsets[8];
     
  char contents[kSize*kSize];
  vector<coords> min, max;

  Grid() {
    for (int i=0; i<kSize*kSize; ++i) {
      contents[i] = '.';
    }
    coords temp(kSize/2,kSize/2);
    min.push_back(temp);
    max.push_back(temp);
  }

  void addCoords(const coords c) {
    int row = min.back().first;
    int col = min.back().second;
    if (c.first < row) row = c.first;
    if (c.second < col) col = c.second;
    min.push_back(coords(row,col));
    row = max.back().first;
    col = max.back().second;
    if (c.first > row) row = c.first;
    if (c.second > col) col = c.second;
    max.push_back(coords(row,col));
  } 

  void dropCoords() {
    min.pop_back();
    max.pop_back();
  }

  static int expanse(const int mins, const int maxs, 
                     const int v1, const int v2) {
    assert(mins < maxs);
    if (v1 > v2) return expanse(mins,maxs,v2,v1);
    if (v1 > mins) return expanse(mins,maxs,mins,v2);
    if (v2 < maxs) return expanse(mins,maxs,v1,maxs);
    return (mins - v1 + v2 - maxs);
  }

  void place(const char c, const coords pos) {
    if (contents[getVal(pos)] != '.')
      assert(contents[getVal(pos)] == c);
    contents[getVal(pos)] = c;
    addCoords(pos);
  }

  void place(const char c, const int pos) {
    if (contents[pos] != '.')
      assert(contents[pos] == c);
    contents[pos] = c;
    coords co = getCoords(pos);
    addCoords(co);
  }

  char unplace(const int pos) {
    const char val = contents[pos];
    assert (val >= 'A');
    contents[pos] = '.';
    dropCoords();
    return val;
  }

  void print() const {
    for (int r=min.back().first; r<=max.back().first; ++r) {
      for (int c=min.back().second; c<=max.back().second; ++c) {
        cout << contents[getVal(coords(r,c))];
      }
      cout << "\n";
    }
    cout << "\n";
  }

};

int main() {
  Grid g;
  
  coords org = getCoords(g.origin);

  g.place('A',org);
  g.print();

  g.place('B',north(org));
  g.print();

  g.place('B',east(north(org)));
  g.print();

}
