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 namespace std;
using lint = long long int;
struct fast_ios {
  fast_ios() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  };
} fast_ios_;
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[";
  for (auto v : vec) os << v << ",";
  os << "]";
  return os;
}
int N;
vector<string> str_;
int next_combination(int comb) {
  int x = comb & -comb, y = comb + x;
  return ((comb & ~y) / x >> 1) | y;
}
int str[15][15];
int main() {
  cin >> N;
  str_.resize(N);
  cin >> str_;
  for (int i = (0), i_end_ = (N); i < i_end_; i++)
    for (int j = (0), j_end_ = (N); j < j_end_; j++)
      str[i][j] = (str_[i][j] == '1');
  vector<lint> ret(1 << (N - 1));
  if (N == 2) {
    if (str[0][1] == 0) {
      ret = {2, 0};
    } else {
      ret = {0, 2};
    }
  } else {
    for (int c = (0), c_end_ = (N); c < c_end_; c++) {
      const int S = (1 << N) - 1 - (1 << c);
      const int nt = N / 2, nu = N - 1 - nt;
      int T = (1 << nt) - 1;
      if (T & (1 << c)) {
        T += 1 << nt;
        T -= 1 << c;
      }
      while (T < (1 << N)) {
        int U = S - T;
        vector<int> vt, vu;
        for (int d = (0), d_end_ = (N); d < d_end_; d++)
          if ((T >> d) & 1) vt.push_back(d);
        for (int d = (0), d_end_ = (N); d < d_end_; d++)
          if ((U >> d) & 1) vu.push_back(d);
        vector<int> dpt(1 << nt), dpu(1 << nu);
        do {
          int st = 0;
          for (int i = (0), i_end_ = (nt - 1); i < i_end_; i++) {
            st *= 2;
            if (str[vt[i]][vt[i + 1]]) st++;
          }
          st *= 2;
          if (str[vt.back()][c]) st++;
          dpt[st]++;
        } while (next_permutation((vt).begin(), (vt).end()));
        do {
          int st = 0;
          if (str[vu[0]][c]) st++;
          for (int i = (0), i_end_ = (nu - 1); i < i_end_; i++) {
            st *= 2;
            if (str[vu[i]][vu[i + 1]]) st++;
          }
          dpu[st]++;
        } while (next_permutation((vu).begin(), (vu).end()));
        for (int s1 = (0), s1_end_ = (dpt.size()); s1 < s1_end_; s1++)
          for (int s2 = (0), s2_end_ = (dpu.size()); s2 < s2_end_; s2++)
            ret[(s1 << nu) + s2] += 1LL * dpt[s1] * dpu[s2];
        T = (T & ((1 << c) - 1)) + ((T >> (c + 1)) << c);
        T = next_combination(T);
        T = (T & ((1 << c) - 1)) + ((T >> c) << (c + 1));
      }
    }
  }
  for (auto x : ret) printf("%lld ", x);
  puts("");
}