#include <bits/stdc++.h>
using pii = std::pair<int, int>;
#define x first
#define y second
pii operator-(pii a, pii b) {
return {a.x - b.x, a.y - b.y};
}
i64 operator*(pii a, pii b) {
return 1ll * a.x * b.x + 1ll * a.y * b.y;
}
i64 dis2(pii a, pii b) {
auto p = a - b;
return p * p;
}
bool Mid(int a, int b, int c) {
return a <= b and b <= c;
}
struct Draw {
std::string op = "";
pii p1 = {0, 0};
char col = '.';
virtual bool Inside(pii p) = 0; // 纯虚函数
};
struct Circle : public Draw {
int r = 0;
bool Inside(pii p) { // 多态
return dis2(p1, p) <= 1ll * r * r;
}
};
struct Rectangle : public Draw {
pii p2 = {0, 0};
bool Inside(pii p) { // 多态
return Mid(p1.x, p.x, p2.x) and Mid(p1.y, p.y, p2.y);
}
};
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int qn;
std::cin >> qn;
std::vector<Draw *> a;
for (int i = 0; i < qn; i++) {
std::string op;
std::cin >> op;
if (op == "Circle") {
Circle *p = new Circle();
p->op = op;
std::cin >> (p->p1.x) >> (p->p1.y);
std::cin >> (p->r) >> (p->col);
a.push_back(p);
} else if (op == "Rectangle") {
Rectangle *p = new Rectangle();
p->op = op;
std::cin >> (p->p1.x) >> (p->p1.y);
std::cin >> (p->p2.x) >> (p->p2.y);
std::cin >> (p->col);
a.push_back(p);
} else if (op == "Render") {
pii p1, p2;
std::cin >> p1.x >> p1.y;
std::cin >> p2.x >> p2.y;
std::vector res(p2.y - p1.y + 1, std::string(p2.x - p1.x + 1, '.'));
for (auto p : a)
for (int y = p1.y; y <= p2.y; y++)
for (int x = p1.x; x <= p2.x; x++)
if (p->Inside({x, y}))
res[y - p1.y][x - p1.x] = p->col;
// 倒着输出
for (int y = p2.y; y >= p1.y; y--) {
std::cout << res[y - p1.y] << '\n';
}
}
}
}