#include using namespace std; using i64 = int64_t; using vi = vector; using vvi = vector; #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") int main() { vvi win(16, vi(16)); for (int i = 0; i < 16; i++) { for (int j = 0; j < 16; j++) { int k; cin >> k; if (i < j) { if (k == 1) { win[i][j] = 1; win[j][i] = 0; } else { win[i][j] = 0; win[j][i] = 1; } } } } using vm = vector>; vector dp(5, vm(16)); for (int i = 0; i < 16; i++) { dp[0][i][1 << i] = 1; } for (int r = 1; r < 5; r++) { for (int i = 0; i < 16; i++) { for (int j = i + 1; j < 16; j++) { for (auto& p: dp[r - 1][i]) { if (r < 4) { for (auto& q: dp[r - 1][j]) { if (p.first & q.first) continue; if (win[i][j]) { dp[r][i][p.first | q.first] += p.second * q.second; } else { dp[r][j][p.first | q.first] += p.second * q.second; } } } else { int k = ((1 << 16) - 1) ^ p.first; if (dp[r - 1][j].count(k)) { if (win[i][j]) { dp[r][i][p.first | k] += p.second * dp[r - 1][j][k]; } else { dp[r][j][p.first | k] += p.second * dp[r - 1][j][k]; } } } } } } } for (int i = 0; i < 16; i++) { cout << 32768 * dp[4][i][(1 << 16) - 1] << endl; } }