#include using namespace std; int main(){ int N; cin >> N; vector> S(N, vector(N)); for (int i = 0; i < N; i++){ for (int j = 0; j < N; j++){ cin >> S[i][j]; } } vector> dp(N, vector(1 << N, 0)); for (int i = 0; i < N; i++){ dp[i][1 << i] = 1; } for (int i = 2; i <= N; i += 2){ for (int j = 0; j < (1 << N); j++){ if (__builtin_popcount(j) == i){ for (int k = j; k > 0; k = (k - 1) & j){ if (__builtin_popcount(k) == i / 2){ int a = k, b = j - k; for (int l = 0; l < N; l++){ if ((a >> l & 1) == 1){ for (int m = 0; m < N; m++){ if ((b >> m & 1) == 1){ if (S[l][m] == 1){ dp[l][j] += dp[l][a] * dp[m][b]; } else { dp[m][j] += dp[l][a] * dp[m][b]; } } } } } } } } } } for (int i = 0; i < N; i++){ cout << dp[i][(1 << N) - 1] << endl; } }