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;
int nth_bit(int64_t num, int n) { return (num >> n) & 1; }
int pop_count(int bits) {
  bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
  bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
  bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
  bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
  return (bits & 0x0000ffff) + (bits >> 16 & 0x0000ffff);
}
int main() {
  int N;
  cin >> N;
  int A[20][20];
  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < N; j++) A[i][j] = (s[j] == '1');
  }
  int popcnt[1 << 18];
  for (int b = 0; b < (1 << N); b++) popcnt[b] = pop_count(b);
  static uint64_t sub[1 << 18][18];
  for (int i = 0; i < N; i++) sub[1 << i][i] = 1;
  for (int b = 1; b < (1 << N); b++)
    for (int last = 0; last < N; last++)
      if (nth_bit(b, last)) {
        for (int nxt = 0; nxt < N; nxt++)
          if (nth_bit(b, nxt) == 0 && A[last][nxt])
            sub[b + (1 << nxt)][nxt] += sub[b][last];
      }
  static uint64_t psum[1 << 18][19];
  for (int b = 0; b < (1 << N); b++) {
    for (int i = 0; i < N; i++) psum[b][popcnt[b]] += sub[b][i];
  }
  for (int k = 1; k <= N; k++)
    for (int i = 0; i < N; i++)
      for (int b = 0; b < (1 << N); b++)
        if (nth_bit(b, i)) psum[b][k] += psum[b - (1 << i)][k];
  vector<vector<int>> divs[19];
  divs[0].push_back({});
  for (int s = 0; s < N; s++)
    for (auto v : divs[s]) {
      int last = v.size() ? v.back() : 1;
      for (int nxt = last; s + nxt <= N; nxt++) {
        auto v2 = v;
        v2.push_back(nxt);
        divs[s + nxt].push_back(v2);
      }
    }
  static uint64_t ans[1 << 17];
  for (auto& D : divs[N]) {
    uint64_t res = 0;
    for (int b = 0; b < (1 << N); b++) {
      uint64_t prod = 1;
      for (int a : D) prod *= psum[b][a];
      res += prod * ((N - popcnt[b]) % 2 ? -1 : 1);
    }
    do {
      int B = 0, base = 1;
      for (int a : D) {
        for (int i = 0; i < a; i++) {
          if (i < a - 1) B += base;
          base *= 2;
        }
      }
      ans[B] += res;
    } while (next_permutation(D.begin(), D.end()));
  }
  for (int i = 0; i < N - 1; i++)
    for (int b = 0; b < (1 << (N - 1)); b++)
      if (nth_bit(b, i)) ans[b - (1 << i)] -= ans[b];
  for (int b = 0; b < (1 << (N - 1)); b++) printf("%llu ", ans[b]);
  printf("\n");
  return 0;
}