using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray(); public static void Main() { Solve(); } static void Solve() { var n = NN; var map = NArr(n); var list = new List(n); for (var i = 0; i < n; ++i) list.Add(i); var memo = new Dictionary(); var ans = Rep(n, map, list, memo); WriteLine(string.Join("\n", ans)); } static long[] Rep(int n, int[][] map, List list, Dictionary memo) { var key = Key(list); if (memo.ContainsKey(key)) return memo[key]; var ans = new long[n]; if (list.Count == 1) { ans[list[0]] = 1; } else { foreach (var ncr in NCRList(list.Count - 1, list.Count / 2 - 1)) { var a = new List(); var b = new List(); a.Add(list[0]); var pos = 0; for (var i = 0; i + 1 < list.Count; ++i) { if (pos < ncr.Length && ncr[pos] == i) { a.Add(list[i + 1]); ++pos; } else { b.Add(list[i + 1]); } } var am = Rep(n, map, a, memo); var bm = Rep(n, map, b, memo); for (var i = 0; i < n; ++i) for (var j = 0; j < n; ++j) { if (i == j) continue; if (map[i][j] == 1) ans[i] += am[i] * bm[j] * 2; else ans[j] += am[i] * bm[j] * 2; } } } memo[key] = ans; return ans; } static List NCRList(int n, int r) { var res = new List(); _NCRList(n, r, new List(), res); return res; } static void _NCRList(int n, int r, List list, List res) { if (list.Count == r) res.Add(list.ToArray()); for (var i = list.Count == 0 ? 0 : (list.Last() + 1); i < n; ++i) { list.Add(i); _NCRList(n, r, list, res); list.RemoveAt(list.Count - 1); } } static int Key(List set) { var ans = 0; foreach (var si in set) ans += 1 << si; return ans; } }