#include namespace { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" #include #pragma GCC diagnostic pop using namespace std; using namespace atcoder; #define rep(i,n) for(int i = 0; i < (int)(n); i++) #define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--) #define all(x) begin(x), end(x) #define rall(x) rbegin(x), rend(x) template bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; } template bool chmin(T& a, const T& b) { if (b < a) { a = b; return true; } else return false; } using ll = long long; using P = pair; using VI = vector; using VVI = vector; using VL = vector; using VVL = vector; bool s[20][20]; ll dp[1 << 16][16]; } int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; rep(i, n) rep(j, n) cin >> s[i][j]; rep(i, n) dp[1 << i][i] = 1; for(int k = 2; k <= n; k *= 2) { for (int x, y, T = (1 << k) - 1; T < (1 << n); x = T & -T, y = T + x, T = (((T & ~y) / x) >> 1) | y) { auto dfs = [&](auto self, int rest, int now) { if (rest == 0) { assert(__builtin_popcount(now) == k / 2); rep(i, n) dp[T][i] += dp[now][i] << k / 2; return; } int i = __builtin_ctz(rest & -rest); rest ^= 1 << i; rep(j, n) if (rest >> j & 1) self(self, rest ^ 1 << j, now | 1 << (s[i][j] ? i : j)); }; dfs(dfs, T, 0); } } rep(i, n) cout << dp[~(~0U << n)][i] << '\n'; }