#include using namespace std; #include using namespace atcoder; using ll = long long; using VI = vector; using VVI = vector; using VL = vector; using VVL = vector; using VD = vector; using VVD = vector; using VS = vector; using P = pair; using VP = vector

; #define rep(i, n) for (ll i = 0; i < ll(n); i++) #define out(x) cout << x << endl #define dout(x) cout << fixed << setprecision(10) << x << endl #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(),(a).rend() #define sz(x) (int)(x.size()) #define re0 return 0 #define pcnt __builtin_popcountll template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } constexpr int inf = 1e9; constexpr ll INF = 1e18; //using mint = modint1000000007; using mint = modint998244353; int di[4] = {1,0,-1,0}; int dj[4] = {0,1,0,-1}; int main(){ ll h,w,k; cin >> h >> w >> k; VS s(h); rep(i,h)rep(j,w) s[i].push_back('.'); vector>> memo(h,vector>(w,vector(4,-1))); memo[0][0][0] = 0; bool flag = false; ll i = 0,j = 0,state = 0; while(k > 0){ if(s[i][j] == '.') s[i][j] = '#'; else s[i][j] = '.'; ll pi = i,pj = j,pstate = state; //jouge if(state>>1&1){ //ue ll ni = i-1; ll nj = j; if(ni < 0 || nj < 0 || ni >= h || nj >= w){ state ^= 1<<1; } else { i = ni; j = nj; } } else { //shita ll ni = i+1; ll nj = j; if(ni < 0 || nj < 0 || ni >= h || nj >= w){ state ^= 1<<1; } else { i = ni; j = nj; } } if(state&1){ //hidari ll ni = i; ll nj = j-1; if(ni < 0 || nj < 0 || ni >= h || nj >= w){ state ^= 1; } else { i = ni; j = nj; } } else { //migi ll ni = i; ll nj = j+1; if(ni < 0 || nj < 0 || ni >= h || nj >= w){ state ^= 1; } else { i = ni; j = nj; } } if(memo[i][j][state] == -1 || flag){ memo[i][j][state] = memo[pi][pj][pstate]+1; } else { flag = true; k %= (memo[pi][pj][pstate]-memo[i][j][state]+1)*2; } k--; } rep(i,h) out(s[i]); }