#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll>PII; const int N = 2e5 + 10; const int MOD = 998244353; const int INF = 0X3F3F3F3F; const int dx[] = {-1, 1, 0, 0, -1, -1, +1, +1}; const int dy[] = {0, 0, -1, 1, -1, +1, -1, +1}; const int M = 1e6 + 10; int n; char g[1100][1100]; int main() { cin >> n; string s, o; for(int i = 1; i <= (1 << n); i ++) { for(int j = 1; j <= (1 << n); j ++) { cin >> g[i][j]; if(g[i][j] == '#') s += '1'; else s += '0'; if(s.size() == 4) { reverse(s.begin(), s.end()); ll p = 0; for(int k = 0; k < 4; k ++) { p += (s[k] == '1' ? (1 << k) : 0); } cout << p << " "; s = o; } } } }