#include const int bit[17] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536}; int S[16][16]; long long ans[65536] = {}; void DFS(int N, int flag[], long long x) { int i, j; for (i = 0; i < N; i++) if (flag[i] > 0) break; if (i == N) { for (i = 0, j = 0; i < N; i++) if (flag[i] != 0) j |= bit[i]; ans[j] += x; return; } for (j = i + 1; j < N; j++) { if (flag[j] <= 0) continue; if (S[i][j] == 0) { flag[i] = 0; flag[j] = -1; } else { flag[i] = -1; flag[j] = 0; } DFS(N, flag, x * 2); flag[i] = 1; flag[j] = 1; } } int main() { int i, j, N; scanf("%d", &N); for (i = 0; i < N; i++) for (j = 0; j < N; j++) scanf("%d", &(S[i][j])); int flag[16]; for (i = bit[N] - 1, ans[bit[N] - 1] = 1; i > 0; i--) { for (j = 0; j < N; j++) if (bit[j] == i) break; if (j < N || ans[i] == 0) continue; for (j = 0; j < N; j++) flag[j] = ((i & bit[j]) == 0)? 0: 1; DFS(N, flag, ans[i]); } for (i = 0; i < N; i++) printf("%lld\n", ans[bit[i]]); fflush(stdout); return 0; }