#include using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; typedef unsigned long long ull; #define MOD 1000000007 ll dp[(1<<20)+5]; ll cnt[(1<<20)+5]; int N; string text[25]; ll diff[25][25]; ll ret[25]; int main(){ cin >> N; rep(i,N){ cin >> text[i]; } dp[0] = 0; cnt[0] = 1; rep(i,N){ rep(j,N){ int p = 0; while(true){ if(p == text[i].size()){ diff[i][j] = p+1; break; } if(p == text[j].size()){ diff[i][j] = p+1; break; } if(text[i][p] != text[j][p]){ diff[i][j] = p+1; break; } p++; } } } for(ll S=0; S<(1LL<>i)&1) == 0){ ll x = 0; rep(j,N) if(i!=j) if(((S>>j)&1) == 0) { x = max(x, diff[i][j]); } if(x == 0) x = 1; dp[S | (1<>i)&1) x++; ret[x] += dp[S]; ret[x] %= MOD; } REP(i,1,N+1){ cout << ret[i] << endl; } /* for(ll S=0; S<(1LL<>i)&1) cout << 1; else cout << 0; } cout << "\t" << dp[S] << "\t" << cnt[S] << endl; } */ return 0; }