#include using namespace std; //* ATCODER #include using namespace atcoder; typedef modint998244353 mint; //*/ /* BOOST MULTIPRECISION #include using namespace boost::multiprecision; //*/ typedef long long ll; #define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++) #define rrep(i, s, n) for (int i = (int)(n)-1; i >= (int)(s); i--) template bool chmin(T &a, const T &b) { if (a <= b) return false; a = b; return true; } template bool chmax(T &a, const T &b) { if (a >= b) return false; a = b; return true; } template T max(vector &a){ assert(!a.empty()); T ret = a[0]; for (int i=0; i<(int)a.size(); i++) chmax(ret, a[i]); return ret; } template T min(vector &a){ assert(!a.empty()); T ret = a[0]; for (int i=0; i<(int)a.size(); i++) chmin(ret, a[i]); return ret; } template T sum(vector &a){ T ret = 0; for (int i=0; i<(int)a.size(); i++) ret += a[i]; return ret; } // JOUTAI ... (ICHI, HOUKOU) // DOUBLING int main(){ int h, w; cin >> h >> w; ll k; cin >> k; vector go(4, vector(h, vector>(w))); rep(i,0,4){ rep(j,0,h){ rep(l,0,w){ int x = j, y = l, t = i; if (i&1){ x = x-1; }else{ x = x+1; } if (!(0 <= x && x < h)){ t ^= 1; x = min(x, h-1); x = max(x, 0); } if (i&2){ y = y-1; }else{ y = y+1; } if (!(0 <= y && y < w)){ t ^= 2; y = min(y, w-1); y = max(y, 0); } go[i][j][l] = make_tuple(t, x, y); } } } vector dp(4, vector(h, vector(w))); dp[0][0][0] = 1; //return 0; vector pp(4, vector(h, vector(w))); pp[0][0][0] = 1; //return 0; k--; rep(num,0,60){ if (k >> num & 1){ vector pr(4, vector(h, vector(w))); rep(i,0,4){ rep(j,0,h){ rep(l,0,w){ auto [x, y, z] = go[i][j][l]; pr[x][y][z] ^= pp[i][j][l]; } } } rep(i,0,4){ rep(j,0,h){ rep(l,0,w){ pr[i][j][l] ^= dp[i][j][l]; } } } pp = pr; } vector ndp = dp; rep(i,0,4){ rep(j,0,h){ rep(l,0,w){ auto [x, y, z] = go[i][j][l]; ndp[x][y][z] ^= dp[i][j][l]; } } } dp = ndp; vector ngo(4, vector(h, vector>(w))); rep(i,0,4){ rep(j,0,h){ rep(l,0,w){ auto [x1, y1, z1] = go[i][j][l]; auto [x2, y2, z2] = go[x1][y1][z1]; ngo[i][j][l] = tuple(x2, y2, z2); } } } go = ngo; } //return 0; rep(i,0,h){ rep(j,0,w){ int g = 0; rep(l,0,4){ g ^= pp[l][i][j]; } if (g == 0){ cout << '.'; }else{ cout << '#'; } } cout << endl; } }