N = int(input()) S = [list(map(int,input().split())) for _ in range(N)] dp = [[0] * N for _ in range(1 << N)] for i in range(N): for j in range(i + 1,N): bit = (1 << i) | (1 << j) if S[i][j] == 1: dp[bit][i] = 2 else: dp[bit][j] = 2 s = set([4,8,16]) for bit in range(1,1 << N): u = bin(bit).count('1') if u not in s:continue v = u // 2 T = bit while T: T -= 1 T &= bit if bin(T).count('1') != v:continue V = bit ^ T for i in range(N): if (T >> i) & 1 == 0:continue for j in range(N): #if (V >> j) & 1 == 0:continue if S[i][j] == 1: dp[bit][i] += dp[T][i] * dp[V][j] else: dp[bit][j] += dp[T][i] * dp[V][j] for k in range(N): print(dp[-1][k])