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;
template <typename _T>
using pair2 = pair<_T, _T>;
template <typename _T>
using pair3 = pair<pair<_T, _T>, _T>;
template <typename _T>
using pair4 = pair<pair<_T, _T>, pair<_T, _T> >;
template <typename _T>
using priq = priority_queue<_T>;
template <typename _T>
using qrip = priority_queue<_T, vector<_T>, greater<_T> >;
const long double pi = acosl(-1);
const int Inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3fll;
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1},
          dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
unsigned Rand() { return rand() * 32768 + rand(); }
int rand(int a, int b) { return Rand() % (b - a + 1) + a; }
template <typename _T>
inline _T chmin(_T &a, _T b) {
  return a > b ? (a = b) : a;
}
template <typename _T>
inline _T chmax(_T &a, _T b) {
  return a < b ? (a = b) : a;
}
template <typename _T, int len>
struct BIT {
  _T dt[len];
  inline void add(int a, _T x) {
    while (a < len) {
      dt[a] += x;
      a += a & -a;
    }
  }
  inline void add(int l, int r, _T x) {
    add(l, x);
    add(r + 1, -x);
  }
  inline _T get(int a) {
    _T ans = 0;
    while (a) {
      ans += dt[a];
      a -= a & -a;
    }
    return ans;
  }
  inline _T get(int l, int r) { return get(r) - get(l - 1); }
};
template <typename _T, int len>
struct segbit {
  _T dt[2][len];
  inline void add(int a, _T x) {
    int b = a;
    while (a < len) {
      dt[0][a] += x;
      dt[1][a] += x * b;
      a += a & -a;
    }
  }
  inline void add(int l, int r, _T x) {
    add(l, x);
    add(r + 1, -x);
  }
  inline _T sum(int a) {
    _T ans = 0;
    int b = a;
    while (a) {
      ans += (b + 1) * dt[0][a] - dt[1][a];
      a -= a & -a;
    }
    return ans;
  }
  inline _T sum(int l, int r) { return sum(r) - sum(l - 1); }
};
struct fastIO {
  inline fastIO operator>>(int &num) {
    num = 0;
    char c = getchar();
    while (c != '-' && (c < '0' || c > '9')) c = getchar();
    bool foo = 0;
    if (c == '-') {
      foo = 1;
      c = getchar();
    }
    while (c >= '0' && c <= '9') {
      num = (num << 3) + (num << 1) + c - '0';
      c = getchar();
    }
    if (foo) num = -num;
    return *this;
  }
  inline fastIO operator>>(long long &num) {
    num = 0;
    char c = getchar();
    while (c != '-' && (c < '0' || c > '9')) c = getchar();
    bool foo = 0;
    if (c == '-') {
      foo = 1;
      c = getchar();
    }
    while (c >= '0' && c <= '9') {
      num = (num << 3) + (num << 1) + c - '0';
      c = getchar();
    }
    if (foo) num = -num;
    return *this;
  }
  inline fastIO operator>>(float &num) {
    scanf("%f", &num);
    return *this;
  }
  inline fastIO operator>>(double &num) {
    scanf("%lf", &num);
    return *this;
  }
  inline fastIO operator>>(long double &num) {
    scanf("%Lf", &num);
    return *this;
  }
  inline fastIO operator>>(char &num) {
    num = getchar();
    while (num == ' ' || num == '\n') num = getchar();
    return *this;
  }
  inline fastIO operator>>(char *num) {
    int cnt = 0;
    char c = getchar();
    while (c == ' ' || c == '\n') c = getchar();
    while (c != ' ' && c != '\n') {
      num[cnt++] = c;
      c = getchar();
    }
    num[cnt] = 0;
    return *this;
  }
  inline fastIO operator>>(string &num) {
    cin >> num;
    return *this;
  }
  inline void printInt(const int &num) {
    if (num < 10) {
      putchar(num + '0');
      return;
    }
    printInt(num / 10);
    putchar((num % 10) + '0');
  }
  inline void printll(const long long &num) {
    if (num < 10) {
      putchar(num + '0');
      return;
    }
    printll(num / 10);
    putchar((num % 10) + '0');
  }
  inline fastIO operator<<(const int &num) {
    if (num < 0)
      putchar('-'), printInt(-num);
    else
      printInt(num);
    return *this;
  }
  inline fastIO operator<<(const long long &num) {
    if (num < 0)
      putchar('-'), printll(-num);
    else
      printll(num);
    return *this;
  }
  inline fastIO operator<<(const float &num) {
    printf("%.10f", num);
    return *this;
  }
  inline fastIO operator<<(const double &num) {
    printf("%.16lf", num);
    return *this;
  }
  inline fastIO operator<<(const long double &num) {
    printf("%.20Lf", num);
    return *this;
  }
  inline fastIO operator<<(const char &num) {
    putchar(num);
    return *this;
  }
  inline fastIO operator<<(const char *num) {
    for (int i = 0; num[i]; i++) putchar(num[i]);
    return *this;
  }
  inline fastIO operator<<(const string &num) {
    cout << num;
    return *this;
  }
  template <typename _T>
  inline fastIO operator<<(const vector<_T> &vec) {
    printf("{ ");
    for (__typeof((vec).begin()) i = (vec).begin(), ed = (vec).end(); i != ed;
         i++)
      operator<<(*i) << ' ';
    printf("}");
    return *this;
  }
} fio;
const long double eps = 1e-10;
struct point {
  long double x, y;
  long double ang;
  point() {}
  point(long double x, long double y) : x(x), y(y) { ang = atan2l(y, x); }
  inline point operator=(const point &pt) {
    x = pt.x;
    y = pt.y;
    return *this;
  }
  inline point operator-() const { return point(-x, -y); }
  inline point operator+(const point &pt) const {
    return point(x + pt.x, y + pt.y);
  }
  inline point operator-(const point &pt) const {
    return point(x - pt.x, y - pt.y);
  }
  inline point operator*(const long double &a) const {
    return point(x * a, y * a);
  }
  inline point operator/(const long double &a) const {
    return point(x / a, y / a);
  }
  inline point operator^(const long double &ang) const {
    return point(x * cosl(ang) - y * sinl(ang), x * sinl(ang) + y * cosl(ang));
  }
  inline point operator+=(const point &pt) {
    return *this = point(x + pt.x, y + pt.y);
  }
  inline point operator-=(const point &pt) {
    return *this = point(x - pt.x, y - pt.y);
  }
  inline point operator*=(const long double &a) {
    return *this = point(x * a, y * a);
  }
  inline point operator/=(const long double &a) {
    return *this = point(x / a, y / a);
  }
  inline point operator^=(const long double &ang) {
    return *this = point(x * cosl(ang) - y * sinl(ang),
                         x * sinl(ang) + y * cosl(ang));
  }
  inline long double operator*(const point &pt) const {
    return x * pt.x + y * pt.y;
  }
  inline long double operator%(const point &pt) const {
    return x * pt.y - y * pt.x;
  }
  inline long double length() const { return x * x + y * y; }
  inline long double size() const { return sqrtl(x * x + y * y); }
  inline long double operator^(const point &pt) const {
    return acosl(*this * pt) / length() / pt.length();
  }
  inline long double getangle() { return ang = atan2l(y, x); }
  inline long double angle() const { return atan2l(y, x); }
  inline bool operator<(const point &p) const { return ang < p.ang; }
};
inline bool xsmaller(const point &x, const point &y) {
  return fabs(x.x - y.x) < 1e-10 ? x.y < y.y : x.x < y.x;
}
inline bool ysmaller(const point &x, const point &y) {
  return fabs(x.y - y.y) < 1e-10 ? x.x < y.x : x.y < y.y;
}
struct line {
  point a, b;
  line() {}
  line(point a, point b) : a(a), b(b) {}
};
point intersect(line x, line y) {
  point p1 = x.a, v1 = x.b - x.a;
  point p2 = y.a, v2 = y.b - y.a;
  return p1 + v1 * (((p2 - p1) % v2) / (v1 % v2));
}
const int jt = 998244353;
inline int ksmii(int a, int b = jt - 2) {
  if (b < 0) {
    return ksmii(ksmii(a), -b);
  }
  if (!b) {
    return 1;
  }
  int x = ksmii(a, b >> 1);
  x = 1ll * x * x % jt;
  if (b & 1) x = 1ll * x * a % jt;
  return x;
}
template <int len>
struct bitmod {
  int dt[len];
  inline void add(int a, int x) {
    while (a < len) {
      dt[a] = (dt[a] + x) % jt;
      a += a & -a;
    }
  }
  inline void add(int l, int r, int x) {
    add(l, x % jt);
    add(r + 1, jt - x % jt);
  }
  inline int get(int a) {
    int ans = 0;
    while (a) {
      ans = (ans + dt[a]) % jt;
      a -= a & -a;
    }
    return ans;
  }
  inline int get(int l, int r) { return (get(r) - get(l - 1) + jt) % jt; }
};
template <int len>
struct DSU {
  int fa[len], sz[len];
  DSU() {
    for (int i = 0; i < (len); i++) fa[i] = i, sz[i] = 1;
  }
  void init() {
    for (int i = 0; i < (len); i++) fa[i] = i, sz[i] = 1;
  }
  int root(int x) { return fa[x] == x ? x : (fa[x] = root(fa[x])); }
  bool conn(int a, int b) {
    a = root(a);
    b = root(b);
    if (a == b) return 0;
    fa[a] = b;
    sz[b] += sz[a];
    return 1;
  }
};
template <typename _T>
inline _T qp(_T a, int b) {
  if (!b) {
    return 1;
  }
  _T x = qp(a, b >> 1);
  x = x * x;
  if (b & 1) {
    x = x * a;
  }
  return x;
}
template <int R, int C = R>
struct matrix {
  int mat[R][C];
  int *operator[](int x) { return mat[x]; }
  matrix() {
    for (int i = 0; i < (R); i++)
      for (int j = 0; j < (C); j++) mat[i][j] = 0;
  }
  matrix(int x) {
    for (int i = 0; i < (R); i++)
      for (int j = 0; j < (C); j++) mat[i][j] = (i == j ? x : 0);
  }
  matrix<R, C> operator+(const matrix<R, C> m) {
    matrix<R, C> ans;
    for (int i = 0; i < (R); i++)
      for (int j = 0; j < (C); j++)
        ans.mat[i][j] = (mat[i][j] + m.mat[i][j]) % jt;
    return ans;
  }
  template <int D>
  matrix<R, D> operator*(const matrix<C, D> m) {
    matrix<R, D> ans;
    for (int i = 0; i < (R); i++)
      for (int j = 0; j < (C); j++)
        for (int k = 0; k < (D); k++)
          ans.mat[i][k] =
              (ans.mat[i][k] + ((long long)mat[i][j]) * m.mat[j][k]) % jt;
    return ans;
  }
  matrix<R, C> operator+=(const matrix<R, C> m) {
    matrix<R, C> ans;
    for (int i = 0; i < (R); i++)
      for (int j = 0; j < (C); j++)
        ans.mat[i][j] = (mat[i][j] + m.mat[i][j]) % jt;
    return ans;
  }
  matrix<R, C> operator-=(const matrix<R, C> m) {
    matrix<R, C> ans;
    for (int i = 0; i < (R); i++)
      for (int j = 0; j < (C); j++)
        ans.mat[i][j] = (mat[i][j] - m.mat[i][j] + jt) % jt;
    return ans;
  }
  void debug() {
    for (int i = 0; i < (R); i++) {
      for (int j = 0; j < (C); j++)
        if (0) cout << mat[i][j] << ' ';
      if (0) cout << endl;
    }
    if (0) cout << endl;
  }
};
vector<long long> dp[(1ll << (14)) + 5][15];
int n;
char s[15][15];
long long ans[(1ll << (14)) + 5];
int main() {
  fio >> n;
  for (int i = 0; i < (n); i++) {
    fio >> s[i];
  }
  for (int i = 0; i < ((1ll << (n))); i++) {
    for (int j = 0; j < (n); j++) {
      if ((((i) >> (j)) & 1)) {
        dp[i][j].resize((1ll << (__builtin_popcount(i) - 1)));
      }
    }
  }
  for (int i = 0; i < (n); i++) {
    dp[(1ll << (i))][i][0] = 1;
  }
  for (int i = 0; i < ((1ll << (n))); i++) {
    for (int j = 0; j < (n); j++) {
      if ((((i) >> (j)) & 1)) {
        for (int k = 0; k < (((int)((dp[i][j]).size()))); k++) {
          for (int l = 0; l < (n); l++) {
            if (!(((i) >> (l)) & 1)) {
              dp[i | (1ll << (l))][l]
                [k | ((s[j][l] == '1') << (__builtin_popcount(i) - 1))] +=
                  dp[i][j][k];
            }
          }
        }
      }
    }
  }
  for (int j = 0; j < (n); j++) {
    for (int k = 0; k < ((1ll << (n - 1))); k++) {
      ans[k] += dp[((1ll << (n)) - 1)][j][k];
    }
  }
  for (int k = 0; k < ((1ll << (n - 1))); k++) {
    fio << ans[k] << ' ';
  }
  fio << '\n';
  return 0;
}