#include class DisjointSet { public: DisjointSet(int size) : parent_(size), size_(size, 1) { for (int i = 0; i < size; ++i) { parent_[i] = i; } } int Find(int x) { int& p = parent_[x]; if (p != x) p = Find(p); return p; } void Union(int x, int y) { x = Find(x), y = Find(y); if (x == y) return; if (Size(x) > Size(y)) std::swap(x, y); parent_[x] = parent_[y]; size_[y] += size_[x]; } int Size(int x) { return size_[Find(x)]; } bool Same(int x, int y) { return Find(x) == Find(y); } private: std::vector parent_, size_; }; #include template struct is_dereferenceable : std::false_type {}; template struct is_dereferenceable())>> : std::true_type {}; template struct is_iterable : std::false_type {}; template struct is_iterable())), decltype(std::end(std::declval()))>> : std::true_type {}; template struct is_applicable : std::false_type {}; template struct is_applicable::value)>> : std::true_type {}; template void debug(const T& value, const Ts&... args); template void debug(const T& v) { if constexpr (is_dereferenceable::value) { std::cerr << "{"; if (v) { debug(*v); } else { std::cerr << "nil"; } std::cerr << "}"; } else if constexpr (is_iterable::value && !std::is_same::value) { std::cerr << "{"; for (auto it = std::begin(v); it != std::end(v); ++it) { if (it != std::begin(v)) std::cerr << ", "; debug(*it); } std::cerr << "}"; } else if constexpr (is_applicable::value) { std::cerr << "{"; std::apply([](const auto&... args) { debug(args...); }, v); std::cerr << "}"; } else { std::cerr << v; } } template void debug(const T& value, const Ts&... args) { debug(value); std::cerr << ", "; debug(args...); } #if DEBUG #define dbg(...) \ do { \ cerr << #__VA_ARGS__ << ": "; \ debug(__VA_ARGS__); \ cerr << " (L" << __LINE__ << ")\n"; \ } while (0) #else #define dbg(...) #endif void read_from_cin() {} template void read_from_cin(T& value, Ts&... args) { std::cin >> value; read_from_cin(args...); } #define rd(type, ...) \ type __VA_ARGS__; \ read_from_cin(__VA_ARGS__); #define ints(...) rd(int, __VA_ARGS__); #define strings(...) rd(string, __VA_ARGS__); template void write_to_cout(const T& value) { if constexpr (std::is_same::value) { std::cout << (value ? "Yes" : "No"); } else if constexpr (is_iterable::value && !std::is_same::value) { for (auto it = std::begin(value); it != std::end(value); ++it) { if (it != std::begin(value)) std::cout << " "; std::cout << *it; } } else { std::cout << value; } } template void write_to_cout(const T& value, const Ts&... args) { write_to_cout(value); std::cout << ' '; write_to_cout(args...); } #define wt(...) \ do { \ write_to_cout(__VA_ARGS__); \ cout << '\n'; \ } while (0) #define all(x) (x).begin(), (x).end() #define eb(...) emplace_back(__VA_ARGS__) #define pb(...) push_back(__VA_ARGS__) #define dispatch(_1, _2, _3, name, ...) name #define as_i64(x) \ ( \ [] { \ static_assert( \ std::is_integral< \ typename std::remove_reference::type>::value, \ "rep macro supports std integral types only"); \ }, \ static_cast(x)) #define rep3(i, a, b) for (std::int64_t i = as_i64(a); i < as_i64(b); ++i) #define rep2(i, n) rep3(i, 0, n) #define rep1(n) rep2(_loop_variable_, n) #define rep(...) dispatch(__VA_ARGS__, rep3, rep2, rep1)(__VA_ARGS__) #define rrep3(i, a, b) for (std::int64_t i = as_i64(b) - 1; i >= as_i64(a); --i) #define rrep2(i, n) rrep3(i, 0, n) #define rrep1(n) rrep2(_loop_variable_, n) #define rrep(...) dispatch(__VA_ARGS__, rrep3, rrep2, rrep1)(__VA_ARGS__) #define each3(k, v, c) for (auto&& [k, v] : c) #define each2(e, c) for (auto&& e : c) #define each(...) dispatch(__VA_ARGS__, each3, each2)(__VA_ARGS__) template std::istream& operator>>(std::istream& is, std::vector& v) { for (T& vi : v) is >> vi; return is; } template std::istream& operator>>(std::istream& is, std::pair& p) { is >> p.first >> p.second; return is; } template bool chmax(T& a, U b) { if (a < b) { a = b; return true; } return false; } template bool chmin(T& a, U b) { if (a > b) { a = b; return true; } return false; } template auto max(T a, U b) { return a > b ? a : b; } template auto min(T a, U b) { return a < b ? a : b; } template std::int64_t sz(const T& v) { return std::size(v); } template std::int64_t popcount(T i) { return std::bitset::digits>(i).count(); } template bool hasbit(T s, int i) { return std::bitset::digits>(s)[i]; } template auto div_floor(T n, U d) { if (d < 0) { n = -n; d = -d; } if (n < 0) { return -((-n + d - 1) / d); } return n / d; }; template auto div_ceil(T n, U d) { if (d < 0) { n = -n; d = -d; } if (n < 0) { return -(-n / d); } return (n + d - 1) / d; } template bool even(T x) { return x % 2 == 0; } const std::int64_t big = std::numeric_limits::max() / 4; using i64 = std::int64_t; using i32 = std::int32_t; template using low_priority_queue = std::priority_queue, std::greater>; template using V = std::vector; template using VV = V>; void Main(); int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); std::cout << std::fixed << std::setprecision(20); Main(); return 0; } const auto& Fix = boost::hana::fix; using namespace std; #define int i64 pair> Solve(int h, int w, int x) { if (!even(x)) return {false, {}}; V g(h, string(w, '#')); rep(i, h) rep(j, w) if (even(i) && even(j)) g[i][j] = '.'; rep(i, h) g[i][0] = '+'; // rep(i, w) g[0][i] = '.'; for (int c = 1; c < w; c += 4) g[h - 1][c] = '+'; g[h - 1][w - 1] = '+'; x -= (h - 1) + (w - 1); if (x < 0) return {false, {}}; rep(i, (w - 1) / 4) { int d = x / 4; int y = (h - 1) / 2; int z = min(d, y); dbg(x, z); int c = i * 4 + 2; int r = h - 1; dbg(d, y, z, c, r); g[r][c] = '+'; rep(j, z) { rep(2) { --r; g[r][c] = '+'; } } /* if (r > 0) { int r2 = r - 2; int c2 = c; while (r2 >= 0) { g[r2][c2] = '.'; --r2; } ++r2; g[r2][c2 - 1] = '.'; g[r2][c2 + 1] = '.'; while (r2 <= r - 2) { g[r2][c2 + 1] = '.'; ++r2; } } */ rep(2) { ++c; g[r][c] = '+'; } rep(j, z) { rep(2) { ++r; g[r][c] = '+'; } } x -= z * 4; // rep(r, h) dbg(i, g[r]); } // int cnt = 0; DisjointSet ds(h * w); auto idx = [&](int i, int j) { return i * w + j; }; int di[] = {0, 1, 0, -1}; int dj[] = {1, 0, -1, 0}; rep(i, h) rep(j, w) { if (g[i][j] != '+') continue; rep(d, 4) { int ni = i + di[d]; int nj = j + dj[d]; if (0 <= ni && ni < h && 0 <= nj && nj < w) { if (g[ni][nj] != '+') continue; ds.Union(idx(i, j), idx(ni, nj)); } } } rep(i, h) rep(j, w) { if (g[i][j] == '.') { rep(d, 4) { int ni = i + di[d] * 2; int nj = j + dj[d] * 2; if (0 <= ni && ni < h && 0 <= nj && nj < w) { if (g[ni][nj] != '#') { if (ds.Same(idx(i, j), idx(ni, nj))) continue; ds.Union(idx(i, j), idx(ni, nj)); g[i + di[d]][j + dj[d]] = 'o'; } /* if ((ni == 0 && nj == 0) || (ni == h - 1 && nj == w - 1)) { if (ds.Same(idx(i, j), idx(ni, nj))) continue; ds.Union(idx(i, j), idx(ni, nj)); g[i + di[d]][j + dj[d]] = '!'; } */ } } } } rep(i, h) rep(j, w) { if (even(i) && even(j)) assert(g[i][j] != '#'); if (!even(i) && !even(j)) assert(g[i][j] == '#'); } if (x == 0) { rep(i, h) dbg(g[i]); } rep(i, h) rep(j, w) if (g[i][j] != '#') g[i][j] = '.'; return {x == 0, g}; } void Main() { ints(h, w, x); if (auto [ok, g] = Solve(h, w, x); ok) { each(e, g) wt(e); return; } if (auto [ok, g] = Solve(w, h, x); ok) { rep(i, h) { rep(j, w) cout << g[j][i]; cout << endl; } return; } wt(-1); }