#include #define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i)) using ll = long long; using namespace std; constexpr int N = 16; array solve(array, N> a) { vector > dp(1 << N); REP (s, 1 << N) if (__builtin_popcount(__builtin_popcount(s)) == 1) { int k = __builtin_popcount(s); if (k == 1) { int i = __builtin_ctz(s); dp[s][i] = 1; } else { for (int t1 = 0; ; t1 = (t1 - s) & s) { int t2 = s ^ t1; if (__builtin_popcount(t1) == __builtin_popcount(t2)) { REP (i, N) if (t1 & (1 << i)) { REP (j, N) if (t2 & (1 << j)) { dp[s][a[i][j] ? i : j] += dp[t1][i] * dp[t2][j]; } } } if (t1 == s) break; } } } return dp[(1 << N) - 1]; } int main() { array, N> a = {}; REP (y, N) REP (x, N) { int b; cin >> b; if (b == 1) { a[y][x] = true; } else if (b == -1) { a[x][y] = true; } } auto answer = solve(a); REP (i, N) { cout << answer[i] << endl; } return 0; }