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;
const int MOD = 1e9 + 7;
const int MX = 2e5 + 5;
const long long INF = 1e18;
const long double PI = acos((long double)-1);
const int xd[4] = {1, 0, -1, 0}, yd[4] = {0, 1, 0, -1};
template <class T>
bool ckmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
bool ckmax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
int pct(int x) { return __builtin_popcount(x); }
int bit(int x) { return 31 - __builtin_clz(x); }
int cdiv(int a, int b) { return a / b + !(a < 0 || a % b == 0); }
template <class A>
void re(complex<A>& c);
template <class A, class B>
void re(pair<A, B>& p);
template <class A>
void re(vector<A>& v);
template <class A, size_t SZ>
void re(array<A, SZ>& a);
template <class T>
void re(T& x) {
  cin >> x;
}
void re(double& d) {
  string t;
  re(t);
  d = stod(t);
}
void re(long double& d) {
  string t;
  re(t);
  d = stold(t);
}
template <class H, class... T>
void re(H& h, T&... t) {
  re(h);
  re(t...);
}
template <class A>
void re(complex<A>& c) {
  A a, b;
  re(a, b);
  c = {a, b};
}
template <class A, class B>
void re(pair<A, B>& p) {
  re(p.first, p.second);
}
template <class A>
void re(vector<A>& x) {
  for (auto& a : x) re(a);
}
template <class A, size_t SZ>
void re(array<A, SZ>& x) {
  for (auto& a : x) re(a);
}
template <class A, class B>
string to_string(pair<A, B> p);
template <class A>
string to_string(complex<A> c) {
  return to_string(make_pair(c.real(), c.imag()));
}
string to_string(bool b) { return b ? "true" : "false"; }
string to_string(char c) {
  string second = "";
  second += c;
  return second;
}
string to_string(string second) { return second; }
string to_string(const char* second) { return (string)second; }
string to_string(vector<bool> v) {
  bool fst = 1;
  string res = "{";
  for (int i = (0); i < ((int)v.size()); ++i) {
    if (!fst) res += ", ";
    fst = 0;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
template <size_t SZ>
string to_string(bitset<SZ> b) {
  string res = "";
  for (int i = (0); i < (SZ); ++i) res += char('0' + b[i]);
  return res;
}
template <class T>
string to_string(T v) {
  bool fst = 1;
  string res = "{";
  for (const auto& x : v) {
    if (!fst) res += ", ";
    fst = 0;
    res += to_string(x);
  }
  res += "}";
  return res;
}
template <class A, class B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <class A>
void pr(A x) {
  cout << to_string(x);
}
template <class H, class... T>
void pr(const H& h, const T&... t) {
  pr(h);
  pr(t...);
}
void ps() { pr("\n"); }
template <class H, class... T>
void ps(const H& h, const T&... t) {
  pr(h);
  if (sizeof...(t)) pr(" ");
  ps(t...);
}
void DBG() { cerr << "]" << endl; }
template <class H, class... T>
void DBG(H h, T... t) {
  cerr << to_string(h);
  if (sizeof...(t)) cerr << ", ";
  DBG(t...);
}
void setIn(string second) { freopen(second.c_str(), "r", stdin); }
void setOut(string second) { freopen(second.c_str(), "w", stdout); }
void unsyncIO() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}
void setIO(string second = "") {
  unsyncIO();
  if ((int)second.size()) {
    setIn(second + ".in"), setOut(second + ".out");
  }
}
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());
int n;
string gr[18];
vector<int> v;
vector<vector<int> > part;
map<vector<int>, int> rpart;
vector<int> cur = {1};
vector<long long> val;
long long ans[1 << 17];
void gen(int sum) {
  if (sum == n) {
    part.push_back(cur);
    return;
  }
  if (sum + cur.back() <= n) {
    cur.push_back(cur.back());
    gen(sum + cur.back());
    cur.pop_back();
  }
  cur.back()++;
  gen(sum + 1);
  cur.back()--;
}
int CNT;
vector<long long> num;
void GEN(int sum, long long prod) {
  if (sum == n) {
    val[CNT++] += prod * num[cur.back()];
    return;
  }
  if (sum + cur.back() <= n) {
    cur.push_back(cur.back());
    GEN(sum + cur.back(), prod * num[cur.back()]);
    cur.pop_back();
  }
  cur.back()++;
  GEN(sum + 1, prod);
  cur.back()--;
}
int main() {
  setIO();
  re(n);
  for (int i = (0); i < (n); ++i) re(gr[i]);
  gen(1);
  val.resize((int)part.size());
  for (int i = (0); i < ((int)part.size()); ++i) rpart[part[i]] = i;
  for (int i = (0); i < (1 << n); ++i) {
    vector<long long> cur(n);
    for (int j = (0); j < (n); ++j)
      if (i & (1 << j)) cur[j] = 1;
    num = vector<long long>(n + 1);
    for (int z = (1); z < (n + 1); ++z) {
      for (auto& t : cur) num[z] += t;
      vector<long long> CUR(n);
      for (int j = (0); j < (n); ++j)
        if (i & (1 << j))
          for (int k = (0); k < (n); ++k)
            if (i & (1 << k))
              if (gr[j][k] == '1') CUR[k] += cur[j];
      swap(cur, CUR);
    }
    int par = (n - pct(i)) & 1;
    if (par == 0)
      par = 1;
    else
      par = -1;
    CNT = 0;
    GEN(1, par);
  }
  for (int i = (0); i < (1 << (n - 1)); ++i) {
    vector<int> len = {1};
    for (int j = (0); j < (n - 1); ++j) {
      if (i & (1 << j))
        len.back()++;
      else
        len.push_back(1);
    }
    sort(begin(len), end(len));
    ans[i] = val[rpart[len]];
  }
  for (int j = (0); j < (n - 1); ++j)
    for (int i = (0); i < (1 << (n - 1)); ++i)
      if (i & (1 << j)) ans[i ^ (1 << j)] -= ans[i];
  for (int i = (0); i < (1 << (n - 1)); ++i) pr(ans[i], ' ');
  ps();
}