#include using namespace std::literals::string_literals; using i64 = std::int_fast64_t; using std::cerr; using std::cin; using std::cout; using std::endl; #if defined(DONLINE_JUDGE) #define NDEBUG #elif defined(ONLINE_JUDGE) #define NDEBUG #endif template std::vector make_v(size_t a) { return std::vector(a); } template auto make_v(size_t a, Ts... ts) { return std::vector(ts...))>(a, make_v(ts...)); } int main() { int h, w; i64 k; scanf("%d%d%lld", &h, &w, &k); auto color = make_v(h, w); for (auto& x : color) for (auto& y : x) y = 0; auto used = make_v(h, w, 4); for (auto& x : used) for (auto& y : x) for (auto& z : y) z = 0; int y = 0, x = 0, dy = 1, dx = 1, cnt = 0; while (cnt < k) { const int state = ((dy == 1) << 1) | (dx == 1); if (used[y][x][state]) { const i64 repeat = k / cnt; if (repeat % 2 == 0) { for (auto& x : color) for (auto& y : x) y = 0; } k %= cnt; cnt = 0; break; } used[y][x][state] = 1; ++cnt; color[y][x] = 1 - color[y][x]; if (0 <= y + dy and y + dy < h) y = y + dy; else dy = -dy; if (0 <= x + dx and x + dx < w) x = x + dx; else dx = -dx; } while (cnt < k) { ++cnt; color[y][x] = 1 - color[y][x]; if (0 <= y + dy and y + dy < h) y = y + dy; else dy = -dy; if (0 <= x + dx and x + dx < w) x = x + dx; else dx = -dx; } for (int i = 0; i < h; ++i) { for (int j = 0; j < w; ++j) { putchar(color[i][j] == 0 ? '.' : '#'); } putchar('\n'); } return 0; }