import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; class Main { public static void main(String[] args) { new Main().run(); } long MODULO = 1_000_000_000 + 7; long[] fac = new long[2001]; { fac[0] = 1; for (int i = 1; i < fac.length; ++i) { fac[i] = fac[i - 1] * i % MODULO; } } void run() { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String[] s = new String[n]; for (int i = 0; i < n; ++i) { s[i] = sc.next(); } Arrays.sort(s); long[][] f = new long[n][n]; for (int i = 0; i < n; ++i) { f[i][i] = s[i].length(); if (i + 1 < n) { int L = 0; while (L < Math.min(s[i].length(), s[i + 1].length()) && s[i].charAt(L) == s[i + 1].charAt(L)) { ++L; } f[i][i + 1] = L; f[i + 1][i] = L; } } for (int i = 0; i < n; ++i) { for (int j = i + 2; j < n; ++j) { f[i][j] = Math.min(f[j - 1][j], f[i][j - 1]); f[j][i] = f[i][j]; } } long[][] comb = new long[2001][2001]; comb[0][0] = 1; for (int i = 1; i <= 2000; ++i) { for (int j = 0; j <= i; ++j) { comb[i][j] = (j > 0 ? comb[i - 1][j - 1] : 0) + comb[i - 1][j]; comb[i][j] %= MODULO; } } long[] dp = new long[n + 1]; for (int a = 0; a < n; ++a) { for (int b = a + 1; b < n; ++b) { dp[b - a] += Math.max(f[a][b], b + 1 < n ? f[b][b + 1] : 0) + 1; dp[b - a] %= MODULO; } } long[] ans = new long[n + 1]; for (int b = 0; b < n; ++b) { for (int K = b + 1; K <= n; ++K) { ans[K] += ((b + 1 < n ? f[b][b + 1] : 0) + 1) * comb[n - (b + 1)][K - (b + 1)] % MODULO * fac[K] % MODULO; ans[K] %= MODULO; } } for (int K = 1; K <= n; ++K) { for (int d = 1; d <= K && n - d - 1 >= 0; ++d) { ans[K] += comb[n - d - 1][K - d] * dp[d] % MODULO * fac[K] % MODULO; ans[K] %= MODULO; } } for(int K=1;K<=n;++K){ System.out.println(ans[K]); } } void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }