Problem: This is the easy version of the problem. The difference is constraints on the number of wise men and the time limit. You can make hacks only if all versions of this task are solved.

n wise men live in a beautiful city. Some of them know each other.

For each of the n! possible permutations p_1, p_2, …, p_n of the wise men, let's generate a binary string of length n-1: for each 1 ≤ i < n set s_i=1 if p_i and p_{i+1} know each other, and s_i=0 otherwise. 

For all possible 2^{n-1} binary strings, find the number of permutations that produce this binary string.

Input

The first line of input contains one integer n (2 ≤ n ≤ 14) — the number of wise men in the city.

The next n lines contain a binary string of length n each, such that the j-th character of the i-th string is equal to '1' if wise man i knows wise man j, and equals '0' otherwise.

It is guaranteed that if the i-th man knows the j-th man, then the j-th man knows i-th man and no man knows himself.

Output

Print 2^{n-1} space-separated integers. For each 0 ≤ x < 2^{n-1}:

  * Let's consider a string s of length n-1, such that s_i = ⌊ \frac{x}{2^{i-1}} ⌋ mod 2 for all 1 ≤ i ≤ n - 1. 
  * The (x+1)-th number should be equal to the required answer for s. 

Examples

Input


3
011
101
110


Output


0 0 0 6 


Input


4
0101
1000
0001
1010


Output


2 2 6 2 2 6 2 2 

Note

In the first test, each wise man knows each other, so every permutation will produce the string 11.

In the second test:

  * If p = \{1, 2, 3, 4\}, the produced string is 101, because wise men 1 and 2 know each other, 2 and 3 don't know each other, and 3 and 4 know each other; 
  * If p = \{4, 1, 2, 3\}, the produced string is 110, because wise men 1 and 4 know each other, 1 and 2 know each other and 2, and 3 don't know each other; 
  * If p = \{1, 3, 2, 4\}, the produced string is 000, because wise men 1 and 3 don't know each other, 3 and 2 don't know each other, and 2 and 4 don't know each other. 

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using std::bitset;
using std::cerr;
using std::cin;
using std::cout;
using std::deque;
using std::endl;
using std::fill;
using std::fixed;
using std::ios_base;
using std::iterator;
using std::map;
using std::max_element;
using std::min_element;
using std::multimap;
using std::multiset;
using std::pair;
using std::queue;
using std::reverse;
using std::set;
using std::setprecision;
using std::sort;
using std::stable_sort;
using std::stack;
using std::string;
using std::swap;
using std::unique;
using std::vector;
long long min(long long a, long long b) { return a < b ? a : b; }
long long min(int a, long long b) { return a < b ? a : b; }
long long min(long long a, int b) { return a < b ? a : b; }
long long min(int a, int b) { return a < b ? a : b; }
long long max(long long a, long long b) { return a > b ? a : b; }
long long max(int a, long long b) { return a > b ? a : b; }
long long max(long long a, int b) { return a > b ? a : b; }
long long max(int a, int b) { return a > b ? a : b; }
namespace MySpace {};
const int N = 16;
const int MOD = 998244353;
int n;
string s[N];
long long g[(1 << N)];
long long dp[N][(1 << N)];
long long ans[(1 << N) / 2];
vector<int> a;
vector<int> fr[1 << N][N + 1];
vector<int> with[N + 1];
vector<long long> dp2(1 << N);
void check() {
  fill((dp2).begin(), (dp2).end(), 0);
  dp2[0] = 1;
  int y = 0;
  for (int i = 0; i < a.size(); i++) {
    int x = a[i];
    y += x;
    for (auto mask2 : with[y]) {
      for (auto mask1 : fr[mask2][y - x]) {
        dp2[mask2] += g[mask2 - mask1] * dp2[mask1];
      }
    }
  }
  int mask = 0;
  for (int i = 0; i < a.size(); i++) {
    for (int j = 0; j < a[i] - 1; j++) {
      mask = 2 * mask + 1;
    }
    mask = 2 * mask;
  }
  mask /= 2;
  ans[mask] += dp2[(1 << n) - 1];
  return;
}
void rec(int x, int lst) {
  if (x == 0) {
    check();
    return;
  }
  for (int i = lst; i <= x; i++) {
    a.push_back(i);
    rec(x - i, i);
    a.pop_back();
  }
  return;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  for (int i = 0; i < (1 << N); i++) {
    with[__builtin_popcount(i)].push_back(i);
    for (int mask = i;; mask = (mask - 1) & i) {
      fr[i][__builtin_popcount(mask)].push_back(mask);
      if (mask == 0) break;
    }
  }
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  for (int i = 0; i < n; i++) {
    dp[i][(1 << i)] = 1;
  }
  for (int mask = 0; mask < (1 << n); mask++) {
    for (int i = 0; i < n; i++) {
      if ((1 << i) & mask) {
        int k = mask - (1 << i);
        if (k != 0) {
          for (int j = 0; j < n; j++) {
            if ((1 << j) & k) {
              if (s[i][j] == '1') {
                dp[i][mask] += dp[j][k];
              }
            }
          }
        }
      }
    }
  }
  for (int mask = 0; mask < (1 << n); mask++) {
    for (int i = 0; i < n; i++) {
      g[mask] += dp[i][mask];
    }
  }
  rec(n, 1);
  for (int mask = 0; mask < (1 << n) / 2; mask++) {
    vector<int> b;
    int len = 0;
    for (int i = 0; i < n - 1; i++) {
      if (mask & (1 << i)) {
        len++;
      } else {
        b.push_back(len + 1);
        len = 0;
      }
    }
    b.push_back(len + 1);
    sort((b).begin(), (b).end());
    int mask_ = 0;
    for (int i = 0; i < b.size(); i++) {
      for (int j = 0; j < b[i] - 1; j++) {
        mask_ = 2 * mask_ + 1;
      }
      mask_ = 2 * mask_;
    }
    mask_ /= 2;
    ans[mask] = ans[mask_];
  }
  for (int mask = 0; mask < (1 << n) / 2; mask++) {
    for (int upmask = mask; upmask < (1 << n) / 2;
         upmask = (upmask + 1) | mask) {
      int b = __builtin_popcount(upmask - mask);
      if (b == 0) continue;
      if (b % 2 == 1)
        ans[mask] -= ans[upmask];
      else
        ans[mask] += ans[upmask];
    }
  }
  for (int i = 0; i < (1 << n) / 2; i++) {
    cout << ans[i] << " ";
  }
  return 0;
}