#include using namespace std; signed main() { ios::sync_with_stdio(false); vector> A(16, vector(16)); for (int i = 0; i < 16; ++i) for (int j = 0; j < 16; ++j) cin >> A[i][j]; for (int i = 0; i < 16; ++i) for (int j = 0; j < i; ++j) A[i][j] = -A[j][i]; vector> bin_set(1 << 16); for (int i = 0; i < 1 << 16; ++i) for (int j = 0; j < 16; ++j) if (i >> j & 1) bin_set[i].push_back(j); vector> dp(16, vector(1 << 16)); for (int i = 0; i < 16; ++i) dp[i][1 << i] = 1; for (int s = 1; s < 1 << 16; ++s) { int bc_s = __builtin_popcount(s); if (bc_s < 2 || __builtin_popcount(bc_s) > 1) continue; for (int a = s; a; a = (a - 1) & s) { if (__builtin_popcount(a) * 2 != __builtin_popcount(s)) continue; int b = s ^ a; for (int i : bin_set[a]) for (int j : bin_set[b]) dp[A[i][j] > 0 ? i : j][s] += dp[i][a] * dp[j][b]; } } vector ans(16); transform(dp.begin(), dp.end(), ans.begin(), [](const vector &v) { return v.back(); }); copy(ans.begin(), ans.end(), ostream_iterator(cout, "\n")); return 0; }