#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; } vector> P(N + 1); for (int i = 0; i < (1 << N); i++){ P[__builtin_popcount(i)].push_back(i); } for (int i = 2; i <= N; i *= 2){ for (int j : P[i]){ for (int k : P[i / 2]){ if ((j & k) == k){ 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; } }