#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<time.h>
#include<string>
#define cl(a,b)	memset(a,b,sizeof(a))
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))
#define REP(i,n) for(int i=0;i<n;++i)
#define REP1(i,a,b) for(int i=a;i<=b;++i)
#define REP2(i,a,b) for(int i=a;i>=b;--i)
#define MP make_pair
#define LL long long
#define ULL unsigned long long
#define X first
#define Y second
#define MOD 1000000007
using namespace std;

const int MAXN = 300050;

struct SuffixArray {
	int wa[MAXN];
	int wb[MAXN];
	int wv[MAXN];
	int ws[MAXN];

	int sa[MAXN];
	int rank[MAXN];
	int height[MAXN];
	int r[MAXN];
	int n;
	int m;

	void input(int *val, int len, int Max) {
		for (int i = 0; i < len; i++)
			r[i] = val[i];
		r[len] = 0;
		n = len;
		m = Max;
		calSa();
		calHeight();
	}

	int cmp(int *r, int a, int b, int l) {
		return (r[a] == r[b] && r[a + l] == r[b + l]);
	}

	void calSa() {
		int i, j, p, *x = wa, *y = wb, *t;
		for (i = 0; i < m; i++)
			ws[i] = 0;
		for (i = 0; i < n + 1; i++)
			ws[x[i] = r[i]]++;
		for (i = 1; i < m; i++)
			ws[i] += ws[i - 1];
		for (i = n; i >= 0; i--)
			sa[--ws[x[i]]] = i;
		for (j = 1, p = 1; p < n + 1; j *= 2, m = p) {
			for (p = 0, i = n - j + 1; i < n + 1; i++)
				y[p++] = i;
			for (i = 0; i < n + 1; i++)
				if (sa[i] >= j)
					y[p++] = sa[i] - j;
			for (i = 0; i < n + 1; i++)
				wv[i] = x[y[i]];
			for (i = 0; i < m; i++)
				ws[i] = 0;
			for (i = 0; i < n + 1; i++)
				ws[wv[i]]++;
			for (i = 1; i < m; i++)
				ws[i] += ws[i - 1];
			for (i = n; i >= 0; i--)
				sa[--ws[wv[i]]] = y[i];
			for (t = x, x = y, y = t, p = 1, x[sa[0]] = 0, i = 1; i < n + 1;
					i++)
				x[sa[i]] = cmp(y, sa[i - 1], sa[i], j) ? p - 1 : p++;
		}
	}

	void calHeight() {
		int i, j, k = 0;
		for (i = 1; i <= n; i++)
			rank[sa[i]] = i;
		for (i = 0; i < n; height[rank[i++]] = k)
			for (k ? k-- : 0, j = sa[rank[i] - 1]; r[i + k] == r[j + k]; k++)
				;
	}

} SA;
char s1[MAXN], s2[MAXN], s3[MAXN];
int s[MAXN];
vector<int> e[MAXN];
int id[MAXN];
LL x[MAXN], y[MAXN], z[MAXN];
int fa[MAXN];
LL cnt[MAXN];
int getfa(int x) {
	if (fa[x] == x)
		return x;
	else
		return fa[x] = getfa(fa[x]);
}
LL mul(int a, int b, int c, int d) {
	return ((((((LL)a * (LL)b) % MOD) * (LL)c) % MOD) * (LL)d) % MOD;
}
int main() {
	int h = 0, len1, len2, len3;
	scanf(" %s %s %s", s1, s2, s3);
	len1 = strlen(s1);
	len2 = strlen(s2);
	len3 = strlen(s3);
	for (int i = 0; i < len1; ++i) {
		id[h] = 0;
		s[h++] = s1[i];
	}
	s[h++] = 1;
	for (int i = 0; i < len2; ++i) {
		id[h] = 1;
		s[h++] = s2[i];
	}
	s[h++] = 2;
	for (int i = 0; i < len3; ++i) {
		id[h] = 2;
		s[h++] = s3[i];
	}
	SA.input(s, h, 500);
//		for(int i=0;i<=h;++i)
//			printf("%d %d %d\n",i,SA.sa[i],SA.height[i]);
	for (int i = 0; i <= h; ++i)
		e[i].clear();
	for (int i = 1; i <= h; ++i) {
		e[SA.height[i]].push_back(i);
	}
	for (int i = 0; i <= h; ++i) {
		fa[i] = i;
		if (id[SA.sa[i]] == 0)
			x[i] = 1, y[i] = 0, z[i] = 0;
		else if (id[SA.sa[i]] == 1)
			x[i] = 0, y[i] = 1, z[i] = 0;
		else
			x[i] = 0, y[i] = 0, z[i] = 1;
	}
	LL pre = 0;
	LL ans = 0;
	for (int i = h; i > 0; --i) {
		for (int j = 0; j < e[i].size(); ++j) {
			int u = e[i][j];
			int f1 = getfa(u);
			int f2 = getfa(u - 1);
//				printf("%d %d\n",f1,f2);
			if (f1 != f2) {
				ans -= mul(x[f2], y[f2], z[f2], 1);
				ans -= mul(x[f1], y[f1], z[f1], 1);
				fa[f1] = f2;
				x[f2] += x[f1];
				y[f2] += y[f1];
				z[f2] += z[f1];
				ans += mul(x[f2], y[f2], z[f2], 1);
				ans = (ans % MOD + MOD) % MOD;
//				printf("%d %I64d\n",i,ans);
			}
			cnt[i]=ans;
		}
	}
	int m = min(len1, len2);
	m = min(len3, m);
	for (int i = 1; i <= m; ++i) {
		printf("%I64d", cnt[i]);
		if (i == m)
			puts("");
		else
			printf(" ");
	}
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<time.h>
#include<string>
#define cl(a,b)	memset(a,b,sizeof(a))
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))
#define REP(i,n) for(int i=0;i<n;++i)
#define REP1(i,a,b) for(int i=a;i<=b;++i)
#define REP2(i,a,b) for(int i=a;i>=b;--i)
#define MP make_pair
#define LL long long
#define ULL unsigned long long
#define X first
#define Y second
#define MOD 1000000007
using namespace std;

const int MAXN = 300050;

struct SuffixArray {
	int wa[MAXN];
	int wb[MAXN];
	int wv[MAXN];
	int ws[MAXN];

	int sa[MAXN];
	int rank[MAXN];
	int height[MAXN];
	int r[MAXN];
	int n;
	int m;

	void input(int *val, int len, int Max) {
		for (int i = 0; i < len; i++)
			r[i] = val[i];
		r[len] = 0;
		n = len;
		m = Max;
		calSa();
		calHeight();
	}

	int cmp(int *r, int a, int b, int l) {
		return (r[a] == r[b] && r[a + l] == r[b + l]);
	}

	void calSa() {
		int i, j, p, *x = wa, *y = wb, *t;
		for (i = 0; i < m; i++)
			ws[i] = 0;
		for (i = 0; i < n + 1; i++)
			ws[x[i] = r[i]]++;
		for (i = 1; i < m; i++)
			ws[i] += ws[i - 1];
		for (i = n; i >= 0; i--)
			sa[--ws[x[i]]] = i;
		for (j = 1, p = 1; p < n + 1; j *= 2, m = p) {
			for (p = 0, i = n - j + 1; i < n + 1; i++)
				y[p++] = i;
			for (i = 0; i < n + 1; i++)
				if (sa[i] >= j)
					y[p++] = sa[i] - j;
			for (i = 0; i < n + 1; i++)
				wv[i] = x[y[i]];
			for (i = 0; i < m; i++)
				ws[i] = 0;
			for (i = 0; i < n + 1; i++)
				ws[wv[i]]++;
			for (i = 1; i < m; i++)
				ws[i] += ws[i - 1];
			for (i = n; i >= 0; i--)
				sa[--ws[wv[i]]] = y[i];
			for (t = x, x = y, y = t, p = 1, x[sa[0]] = 0, i = 1; i < n + 1;
					i++)
				x[sa[i]] = cmp(y, sa[i - 1], sa[i], j) ? p - 1 : p++;
		}
	}

	void calHeight() {
		int i, j, k = 0;
		for (i = 1; i <= n; i++)
			rank[sa[i]] = i;
		for (i = 0; i < n; height[rank[i++]] = k)
			for (k ? k-- : 0, j = sa[rank[i] - 1]; r[i + k] == r[j + k]; k++)
				;
	}

} SA;
char s1[MAXN], s2[MAXN], s3[MAXN];
int s[MAXN];
vector<int> e[MAXN];
int id[MAXN];
LL x[MAXN], y[MAXN], z[MAXN];
int fa[MAXN];
LL cnt[MAXN];
int getfa(int x) {
	if (fa[x] == x)
		return x;
	else
		return fa[x] = getfa(fa[x]);
}
LL mul(int a, int b, int c, int d) {
	return (((((a * b) % MOD) * c) % MOD) * d) % MOD;
}
int main() {
	int h = 0, len1, len2, len3;
	scanf(" %s %s %s", s1, s2, s3);
	len1 = strlen(s1);
	len2 = strlen(s2);
	len3 = strlen(s3);
	for (int i = 0; i < len1; ++i) {
		id[h] = 0;
		s[h++] = s1[i];
	}
	s[h++] = 1;
	for (int i = 0; i < len2; ++i) {
		id[h] = 1;
		s[h++] = s2[i];
	}
	s[h++] = 2;
	for (int i = 0; i < len3; ++i) {
		id[h] = 2;
		s[h++] = s3[i];
	}
	SA.input(s, h, 500);
//		for(int i=0;i<=h;++i)
//			printf("%d %d %d\n",i,SA.sa[i],SA.height[i]);
	for (int i = 0; i <= h; ++i)
		e[i].clear();
	for (int i = 1; i <= h; ++i) {
		e[SA.height[i]].push_back(i);
	}
	for (int i = 0; i <= h; ++i) {
		fa[i] = i;
		if (id[SA.sa[i]] == 0)
			x[i] = 1, y[i] = 0, z[i] = 0;
		else if (id[SA.sa[i]] == 1)
			x[i] = 0, y[i] = 1, z[i] = 0;
		else
			x[i] = 0, y[i] = 0, z[i] = 1;
	}
	LL pre = 0;
	LL ans = 0;
	for (int i = h; i > 0; --i) {
		cnt[i]=cnt[i+1];
		for (int j = 0; j < e[i].size(); ++j) {
			int u = e[i][j];
			int f1 = getfa(u);
			int f2 = getfa(u - 1);
//				printf("%d %d\n",f1,f2);
			if (f1 != f2) {
				ans -= mul(x[f2], y[f2], z[f2], 1);
				ans -= mul(x[f1], y[f1], z[f1], 1);
				fa[f1] = f2;
				x[f2] += x[f1];
				y[f2] += y[f1];
				z[f2] += z[f1];
				ans += mul(x[f2], y[f2], z[f2], 1);
				ans = (ans % MOD + MOD) % MOD;
//				printf("%d %I64d\n",i,ans);
			}
			cnt[i]+=ans-pre;
			cnt[i]=(cnt[i]%MOD+MOD)%MOD;
			pre=ans;
		}
	}
	int m = min(len1, len2);
	m = min(len3, m);
	for (int i = 1; i <= m; ++i) {
		printf("%I64d", cnt[i]);
		if (i == m)
			puts("");
		else
			printf(" ");
	}
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);i++)

const int SZ=300011;
const int LOGSZ=20;

const ll MOD=1000000007;

char A[SZ],B[SZ],C[SZ];
int l[3];
char V[SZ];
int Vlcp[SZ];
int cnt[SZ];

int p[SZ];
int pn[SZ];
int c[LOGSZ][SZ];
int k;
int nlog;

bool cmp(int a, int b,char * s, int n)
{
    int mid1=(a+(1<<k))%n;
    int mid2=(b+(1<<k))%n;
    if(c[k][a]!=c[k][b])
        return c[k][a]<c[k][b];
    return c[k][mid1]<c[k][mid2];
}

void suffix_array(char * s, int n)
{

    int classes=0;

    for(int i=0;i<n;i++)
    {
        classes=max(classes,(int)s[i]);
        cnt[s[i]]++;
        c[0][i]=s[i];
    }
    classes++;
    for(int i=1;i<classes;i++)
        cnt[i]+=cnt[i-1];
    for(int i=n-1;i>=0;i--)
        p[--cnt[s[i]]]=i;
    for(int i=0;i<classes;i++)
        cnt[i]=0;

    for(k=0;(1<<k)<n;k++)
    {
        for(int i=0;i<n;i++)
        {
            pn[i]=p[i]-(1<<k);
            if(pn[i]<0) pn[i]+=n;
        }
        classes=0;
        for(int i=0;i<n;i++)
        {
            cnt[c[k][i]]++;
            classes=max(classes,c[k][i]);
        }
        classes++;
        for(int i=1;i<classes;i++)
            cnt[i]+=cnt[i-1];
        for(int i=n-1;i>=0;i--)
            p[--cnt[c[k][pn[i]]]]=pn[i];
        for(int i=0;i<classes;i++)
            cnt[i]=0;

        classes=0;
        c[k+1][p[0]]=0;
        for(int i=1;i<n;i++)
        {
            if(cmp(p[i-1],p[i],s,n))
                classes++;
            c[k+1][p[i]]=classes;
        }
    }
    nlog=k;
}

int lcp(int a, int b, int n)
{
    int res=0;
    for(int k=nlog;k>=0;k--)
    {
        if(c[k][a]==c[k][b])
        {
            res+=(1<<k);
            a=(a+(1<<k))%n;
            b=(b+(1<<k))%n;
        }
    }
    return res;
}

int par[SZ];
int ccnt[SZ][3];
int counted[SZ];

int dsu_get(int i)
{
    if(par[i]==i) return i;
    return par[i]=dsu_get(par[i]);
}

void unite(int a, int b)
{
    a=dsu_get(a);
    b=dsu_get(b);
    if(a==b) return;
    if(rand()%2)
        swap(a,b);
    par[a]=b;
    counted[b]=(counted[a]+counted[b])%MOD;
    REP(i,3)
        ccnt[b][i]+=ccnt[a][i];
}

bool cmp2(int a, int b)
{
    return Vlcp[a]>Vlcp[b];
}

int res[SZ];

int main()
{
    scanf("%s%s%s",A,B,C);
    l[0]=strlen(A);
    l[1]=strlen(B);
    l[2]=strlen(C);
    int top=0;
    REP(i,l[0])
        V[top++]=A[i];
    V[top++]='#';

    REP(i,l[1])
        V[top++]=B[i];
    V[top++]='$';

    REP(i,l[2])
        V[top++]=C[i];
    V[top++]='&';

    suffix_array(V,top);
    REP(i,top-1)
        Vlcp[i]=lcp(p[i],p[i+1],top);
    REP(i,top)
    {
        par[i]=i;
        if(p[i]<=l[0])
            ccnt[i][0]=1;
        else if(p[i]<=l[0]+1+l[1])
            ccnt[i][1]=1;
        else
            ccnt[i][2]=1;
    }
    vector<int> ev(top-1);
    REP(i,ev.size())
        ev[i]=i;
    sort(ev.begin(),ev.end(),cmp2);
    for(int i=0;i<ev.size();)
    {
        int j=i+1;
        while(j<ev.size() && !cmp2(ev[i],ev[j])) j++;
        for(int k=i;k<j;k++)
            unite(ev[k],ev[k]+1);
        int lcp_val=Vlcp[ev[i]];
        for(int k=i;k<j;k++)
        {
            int id=dsu_get(ev[k]);
            ll val=ccnt[id][0];
            val*=ccnt[id][1];
            val%=MOD;
            val*=ccnt[id][2];
            val%=MOD;
            val-=counted[id];
            val=(val%MOD+MOD)%MOD;
            counted[id]+=val;
            counted[id]%=MOD;
            res[lcp_val]+=val;
            res[lcp_val]%=MOD;
        }
        i=j;
    }
    int ttt=min(l[0],min(l[1],l[2]));
    for(int i=ttt;i>0;i--)
        res[i-1]=(res[i-1]+res[i])%MOD;
    for(int i=1;i<=ttt;i++)
        printf("%d ",res[i]);
    puts("");
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);i++)

const int SZ=300011;
const int LOGSZ=20;

const ll MOD=1000000007;

char A[SZ],B[SZ],C[SZ];
int l[3];
char V[SZ];
int Vlcp[SZ];
int cnt[SZ];

int p[SZ];
int pn[SZ];
int c[LOGSZ][SZ];
int k;
int nlog;

bool cmp(int a, int b,char * s, int n)
{
	int mid1=(a+(1<<k))%n;
	int mid2=(b+(1<<k))%n;
	if(c[k][a]!=c[k][b])
		return c[k][a]<c[k][b];
	return c[k][mid1]<c[k][mid2];
}

void suffix_array(char * s, int n)
{

	int classes=0;

	for(int i=0;i<n;i++)
	{
		classes=max(classes,(int)s[i]);
		cnt[s[i]]++;
		c[0][i]=s[i];
	}
	classes++;
	for(int i=1;i<classes;i++)
		cnt[i]+=cnt[i-1];
	for(int i=n-1;i>=0;i--)
		p[--cnt[s[i]]]=i;
	for(int i=0;i<classes;i++)
		cnt[i]=0;

	for(k=0;(1<<k)<n;k++)
	{
		for(int i=0;i<n;i++)
		{
			pn[i]=p[i]-(1<<k);
			if(pn[i]<0) pn[i]+=n;
		}
		classes=0;
		for(int i=0;i<n;i++)
		{
			cnt[c[k][i]]++;
			classes=max(classes,c[k][i]);
		}
		classes++;
		for(int i=1;i<classes;i++)
			cnt[i]+=cnt[i-1];
		for(int i=n-1;i>=0;i--)
			p[--cnt[c[k][pn[i]]]]=pn[i];
		for(int i=0;i<classes;i++)
			cnt[i]=0;

		classes=0;
		c[k+1][p[0]]=0;
		for(int i=1;i<n;i++)
		{
			if(cmp(p[i-1],p[i],s,n))
				classes++;
			c[k+1][p[i]]=classes;
		}
	}
	nlog=k;
}

int lcp(int a, int b, int n)
{
	int res=0;
	for(int k=nlog;k>=0;k--)
	{
		if(c[k][a]==c[k][b])
		{
			res+=(1<<k);
			a=(a+(1<<k))%n;
			b=(b+(1<<k))%n;
		}
	}
	return res;
}

int par[SZ];
int ccnt[SZ][3];
int counted[SZ];

int dsu_get(int i)
{
	if(par[i]==i) return i;
	return par[i]=dsu_get(par[i]);
}

void unite(int a, int b)
{
	a=dsu_get(a);
	b=dsu_get(b);
	if(a==b) return;
	if(rand()%2)
		swap(a,b);
	par[a]=b;
	counted[b]+=counted[a];
	REP(i,3)
		ccnt[b][i]+=ccnt[a][i];
}

bool cmp2(int a, int b)
{
	return Vlcp[a]>Vlcp[b];
}

int res[SZ];

int main()
{
	scanf("%s%s%s",A,B,C);
	l[0]=strlen(A);
	l[1]=strlen(B);
	l[2]=strlen(C);
	int top=0;
	REP(i,l[0])
		V[top++]=A[i];
	V[top++]='#';

	REP(i,l[1])
		V[top++]=B[i];
	V[top++]='$';

	REP(i,l[2])
		V[top++]=C[i];
	V[top++]='&';

	suffix_array(V,top);
	REP(i,top-1)
		Vlcp[i]=lcp(p[i],p[i+1],top);
	REP(i,top)
	{
		par[i]=i;
		if(p[i]<=l[0])
			ccnt[i][0]=1;
		else if(p[i]<=l[0]+1+l[1])
			ccnt[i][1]=1;
		else
			ccnt[i][2]=1;
	}
	vector<int> ev(top-1);
	REP(i,ev.size())
		ev[i]=i;
	sort(ev.begin(),ev.end(),cmp2);
	for(int i=0;i<ev.size();)
	{
		int j=i+1;
		while(j<ev.size() && !cmp2(ev[i],ev[j])) j++;
		for(int k=i;k<j;k++)
			unite(ev[k],ev[k]+1);
		int lcp_val=Vlcp[ev[i]];
		for(int k=i;k<j;k++)
		{
			int id=dsu_get(ev[k]);
			ll val=ccnt[id][0];
			val*=ccnt[id][1];
			val%=MOD;
			val*=ccnt[id][2];
			val%=MOD;
			val-=counted[id];
			val=(val%MOD+MOD)%MOD;
			counted[id]+=val;
			counted[id]%=MOD;
			res[lcp_val]+=val;
			res[lcp_val]%=MOD;
		}
		i=j;
	}
	int ttt=min(l[0],min(l[1],l[2]));
	for(int i=ttt;i>0;i--)
		res[i-1]=(res[i-1]+res[i])%MOD;
	for(int i=1;i<=ttt;i++)
		printf("%d ",res[i]);
	puts("");
	return 0;
}


#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
#include <vector>
//#include <queue>
//#include <list>
//#include <map>
//#include <set>
#include <string.h>
#include <math.h>
//double PI=acos(-1.0);

#define oo 0x7fffffff
#define ooll 0x7fffffffffffffffLL
#define ll __int64
#define MOD  1000000007

#define NN 311111
#define SIZZ 256
#define F(x) ((x)/3+((x)%3==1?0:tb))
#define G(x) ((x)<tb?(x)*3+1:((x)-tb)*3+2)

int aa[3*NN],bb[NN],cc[NN],xx[NN],yy[NN];
int sa[3*NN],height[NN],rank[NN];
int hf[NN][20];
char s[NN];
int c0(int *r,int a,int b){
	return r[a]==r[b]&&r[a+1]==r[b+1]&&r[a+2]==r[b+2];
}
int c12(int k,int *r,int a,int b){
	if(k==2)return r[a]<r[b]||r[a]==r[b]&&c12(1,r,a+1,b+1);
	else return r[a]<r[b]||r[a]==r[b]&&cc[a+1]<cc[b+1];
}
void sort(int *r,int *a,int *b,int n,int m){
	int i;
	for(i=0;i<n;i++)cc[i]=r[a[i]];
	for(i=0;i<m;i++)bb[i]=0;
	for(i=0;i<n;i++)bb[cc[i]]++;
	for(i=1;i<m;i++)bb[i]+=bb[i-1];
	for(i=n-1;i>=0;i--)b[--bb[cc[i]]]=a[i];
}
void dc3(int *r,int *sa,int n,int m){
	int i,j,ta=0,tb=(n+1)/3,tc=0,p;
	int *rn=r+n,*sn=sa+n;
	r[n]=r[n+1]=0;
	for(i=0;i<n;i++)if(i%3!=0)xx[tc++]=i;
	sort(r+2,xx,yy,tc,m);
	sort(r+1,yy,xx,tc,m);
	sort(r,xx,yy,tc,m);
	for(p=1,rn[F(yy[0])]=0,i=1;i<tc;i++)
	rn[F(yy[i])]=c0(r,yy[i-1],yy[i])?p-1:p++;
	if(p<tc)dc3(rn,sn,tc,p);
	else for(i=0;i<tc;i++)sn[rn[i]]=i;
	for(i=0;i<tc;i++)if(sn[i]<tb)yy[ta++]=sn[i]*3;
	if(n%3==1)yy[ta++]=n-1;
	sort(r,yy,xx,ta,m);
	for(i=0;i<tc;i++)cc[yy[i]=G(sn[i])]=i;
	for(i=0,j=0,p=0;i<ta&&j<tc;p++)
	sa[p]=c12(yy[j]%3,r,xx[i],yy[j])?xx[i++]:yy[j++];
	for(;i<ta;p++)sa[p]=xx[i++];
	for(;j<tc;p++)sa[p]=yy[j++];
}
void calh(int n){
	int i,j,k=0;
	for(i=0;i<n;i++)rank[sa[i]]=i;
	for(i=0;i<n;i++){
		if(k)k--;
		j=sa[rank[i]-1];
		if(rank[i]-1<0)continue;
		while(i+k<n-1&&j+k<n-1&&aa[i+k]==aa[j+k])k++;
		height[rank[i]]=k;
	}
}
vector < pair<int,int> > co[NN];
int fa[NN];
int find(int x){
	return x==fa[x]?x:fa[x]=find(fa[x]);
}
int num[NN][3];
ll ans[NN];
main(){
	int i,j,n=0,top,K;
	int len[3];
	while(scanf("%s",s)!=EOF){
		n=0;
		memset(num,0,sizeof(num));

		int minlen=oo;
		for(i=0;i<3;i++){
			if(i>0)scanf("%s",s);
			len[i]=strlen(s);
			if(len[i]<minlen)minlen=len[i];
			for(j=0;j<len[i];j++){
				aa[n++]=s[j];
				num[n-1][i]=1;
			}
			aa[n++]=SIZZ+i;
			num[n-1][i]=1;
		}
		for(i=0;i<n;i++){
			fa[i]=i;
			co[i].clear();
		}
		dc3(aa,sa,n,SIZZ+10);
		calh(n);
		for(i=1;i<n;i++)co[height[i]].push_back(make_pair(sa[i],sa[i-1]));
		ll temp=0;
		for(i=minlen;i>=1;i--){
			int size=co[i].size();
			for(j=0;j<size;j++){
				int s1=co[i][j].first;
				int s2=co[i][j].second;
				int x=find(s1);
				int y=find(s2);
				temp-=1LL*num[x][0]*num[x][1]*num[x][2];
				temp-=1LL*num[y][0]*num[y][1]*num[y][2];
				fa[y]=x;
				num[x][0]+=num[y][0];
				num[x][1]+=num[y][1];
				num[x][2]+=num[y][2];
				temp+=(1LL*num[x][0]*num[x][1]*num[x][2])%MOD;
			}
			ans[i]=temp;
		}
		for(i=1;i<minlen;i++)printf("%I64d ",ans[i]);
		printf("%I64d\n",ans[i]);
	}
}


#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
#include <vector>
//#include <queue>
//#include <list>
//#include <map>
//#include <set>
#include <string.h>
#include <math.h>
//double PI=acos(-1.0);

#define oo 0x7fffffff
#define ooll 0x7fffffffffffffffLL
#define ll __int64
#define MOD  1000000007

#define NN 311111
#define SIZZ 256
#define F(x) ((x)/3+((x)%3==1?0:tb))
#define G(x) ((x)<tb?(x)*3+1:((x)-tb)*3+2)

int aa[3*NN],bb[NN],cc[NN],xx[NN],yy[NN];
int sa[3*NN],height[NN],rank[NN];
int hf[NN][20];
char s[NN];
int c0(int *r,int a,int b){
	return r[a]==r[b]&&r[a+1]==r[b+1]&&r[a+2]==r[b+2];
}
int c12(int k,int *r,int a,int b){
	if(k==2)return r[a]<r[b]||r[a]==r[b]&&c12(1,r,a+1,b+1);
	else return r[a]<r[b]||r[a]==r[b]&&cc[a+1]<cc[b+1];
}
void sort(int *r,int *a,int *b,int n,int m){
	int i;
	for(i=0;i<n;i++)cc[i]=r[a[i]];
	for(i=0;i<m;i++)bb[i]=0;
	for(i=0;i<n;i++)bb[cc[i]]++;
	for(i=1;i<m;i++)bb[i]+=bb[i-1];
	for(i=n-1;i>=0;i--)b[--bb[cc[i]]]=a[i];
}
void dc3(int *r,int *sa,int n,int m){
	int i,j,ta=0,tb=(n+1)/3,tc=0,p;
	int *rn=r+n,*sn=sa+n;
	r[n]=r[n+1]=0;
	for(i=0;i<n;i++)if(i%3!=0)xx[tc++]=i;
	sort(r+2,xx,yy,tc,m);
	sort(r+1,yy,xx,tc,m);
	sort(r,xx,yy,tc,m);
	for(p=1,rn[F(yy[0])]=0,i=1;i<tc;i++)
	rn[F(yy[i])]=c0(r,yy[i-1],yy[i])?p-1:p++;
	if(p<tc)dc3(rn,sn,tc,p);
	else for(i=0;i<tc;i++)sn[rn[i]]=i;
	for(i=0;i<tc;i++)if(sn[i]<tb)yy[ta++]=sn[i]*3;
	if(n%3==1)yy[ta++]=n-1;
	sort(r,yy,xx,ta,m);
	for(i=0;i<tc;i++)cc[yy[i]=G(sn[i])]=i;
	for(i=0,j=0,p=0;i<ta&&j<tc;p++)
	sa[p]=c12(yy[j]%3,r,xx[i],yy[j])?xx[i++]:yy[j++];
	for(;i<ta;p++)sa[p]=xx[i++];
	for(;j<tc;p++)sa[p]=yy[j++];
}
void calh(int n){
	int i,j,k=0;
	for(i=0;i<n;i++)rank[sa[i]]=i;
	for(i=0;i<n;i++){
		if(k)k--;
		j=sa[rank[i]-1];
		if(rank[i]-1<0)continue;
		while(i+k<n-1&&j+k<n-1&&aa[i+k]==aa[j+k])k++;
		height[rank[i]]=k;
	}
}
vector < pair<int,int> > co[NN];
int fa[NN];
int find(int x){
	return x==fa[x]?x:fa[x]=find(fa[x]);
}
int num[NN][3];
ll ans[NN];
main(){
	int i,j,n=0,top,K;
	int len[3];
	while(scanf("%s",s)!=EOF){
		n=0;
		memset(num,0,sizeof(num));

		int minlen=oo;
		for(i=0;i<3;i++){
			if(i>0)scanf("%s",s);
			len[i]=strlen(s);
			if(len[i]<minlen)minlen=len[i];
			for(j=0;j<len[i];j++){
				aa[n++]=s[j];
				num[n-1][i]=1;
			}
			aa[n++]=SIZZ+i;
			num[n-1][i]=1;
		}
		for(i=0;i<n;i++){
			fa[i]=i;
			co[i].clear();
		}
		dc3(aa,sa,n,SIZZ+10);
		calh(n);
		for(i=1;i<n;i++)co[height[i]].push_back(make_pair(sa[i],sa[i-1]));
		ll temp=0;
		for(i=n;i>=1;i--){
			int size=co[i].size();
			for(j=0;j<size;j++){
				int s1=co[i][j].first;
				int s2=co[i][j].second;
				int x=find(s1);
				int y=find(s2);
				if(x!=y){
					temp-=1LL*num[x][0]*num[x][1]*num[x][2];
					temp-=1LL*num[y][0]*num[y][1]*num[y][2];
					fa[y]=x;
					num[x][0]+=num[y][0];
					num[x][1]+=num[y][1];
					num[x][2]+=num[y][2];
					temp+=(1LL*num[x][0]*num[x][1]*num[x][2])%MOD;
				}
			}
			ans[i]=temp;
		}
		for(i=1;i<minlen;i++)printf("%I64d ",ans[i]);
		printf("%I64d\n",ans[i]);
	}
}


#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
#include <vector>
//#include <queue>
//#include <list>
//#include <map>
//#include <set>
#include <string.h>
#include <math.h>
//double PI=acos(-1.0);

#define oo 0x7fffffff
#define ooll 0x7fffffffffffffffLL
#define ll __int64
#define MOD  1000000007

#define NN 311111
#define SIZZ 256
#define F(x) ((x)/3+((x)%3==1?0:tb))
#define G(x) ((x)<tb?(x)*3+1:((x)-tb)*3+2)

int aa[3*NN],bb[NN],cc[NN],xx[NN],yy[NN];
int sa[3*NN],height[NN],rank[NN];
int hf[NN][20];
char s[NN];
int c0(int *r,int a,int b){
	return r[a]==r[b]&&r[a+1]==r[b+1]&&r[a+2]==r[b+2];
}
int c12(int k,int *r,int a,int b){
	if(k==2)return r[a]<r[b]||r[a]==r[b]&&c12(1,r,a+1,b+1);
	else return r[a]<r[b]||r[a]==r[b]&&cc[a+1]<cc[b+1];
}
void sort(int *r,int *a,int *b,int n,int m){
	int i;
	for(i=0;i<n;i++)cc[i]=r[a[i]];
	for(i=0;i<m;i++)bb[i]=0;
	for(i=0;i<n;i++)bb[cc[i]]++;
	for(i=1;i<m;i++)bb[i]+=bb[i-1];
	for(i=n-1;i>=0;i--)b[--bb[cc[i]]]=a[i];
}
void dc3(int *r,int *sa,int n,int m){
	int i,j,ta=0,tb=(n+1)/3,tc=0,p;
	int *rn=r+n,*sn=sa+n;
	r[n]=r[n+1]=0;
	for(i=0;i<n;i++)if(i%3!=0)xx[tc++]=i;
	sort(r+2,xx,yy,tc,m);
	sort(r+1,yy,xx,tc,m);
	sort(r,xx,yy,tc,m);
	for(p=1,rn[F(yy[0])]=0,i=1;i<tc;i++)
	rn[F(yy[i])]=c0(r,yy[i-1],yy[i])?p-1:p++;
	if(p<tc)dc3(rn,sn,tc,p);
	else for(i=0;i<tc;i++)sn[rn[i]]=i;
	for(i=0;i<tc;i++)if(sn[i]<tb)yy[ta++]=sn[i]*3;
	if(n%3==1)yy[ta++]=n-1;
	sort(r,yy,xx,ta,m);
	for(i=0;i<tc;i++)cc[yy[i]=G(sn[i])]=i;
	for(i=0,j=0,p=0;i<ta&&j<tc;p++)
	sa[p]=c12(yy[j]%3,r,xx[i],yy[j])?xx[i++]:yy[j++];
	for(;i<ta;p++)sa[p]=xx[i++];
	for(;j<tc;p++)sa[p]=yy[j++];
}
void calh(int n){
	int i,j,k=0;
	for(i=0;i<n;i++)rank[sa[i]]=i;
	for(i=0;i<n;i++){
		if(k)k--;
		j=sa[rank[i]-1];
		if(rank[i]-1<0)continue;
		while(i+k<n-1&&j+k<n-1&&aa[i+k]==aa[j+k])k++;
		height[rank[i]]=k;
	}
}
vector < pair<int,int> > co[NN];
int fa[NN];
int find(int x){
	return x==fa[x]?x:fa[x]=find(fa[x]);
}
int num[NN][3];
ll ans[NN];
main(){
	int i,j,n=0,top,K;
	int len[3];
	while(scanf("%s",s)!=EOF){
		n=0;
		memset(num,0,sizeof(num));

		int minlen=oo;
		for(i=0;i<3;i++){
			if(i>0)scanf("%s",s);
			len[i]=strlen(s);
			if(len[i]<minlen)minlen=len[i];
			for(j=0;j<len[i];j++){
				aa[n++]=s[j];
				num[n-1][i]=1;
			}
			aa[n++]=SIZZ+i;
			num[n-1][i]=1;
		}
		for(i=0;i<n;i++){
			fa[i]=i;
			co[i].clear();
		}
		dc3(aa,sa,n,SIZZ+10);
		calh(n);
		for(i=1;i<n;i++)co[height[i]].push_back(make_pair(sa[i],sa[i-1]));
		ll temp=0;
		for(i=minlen;i>=1;i--){
			int size=co[i].size();
			for(j=0;j<size;j++){
				int s1=co[i][j].first;
				int s2=co[i][j].second;
				int x=find(s1);
				int y=find(s2);
				temp-=(((1LL*num[x][0])%MOD*num[x][1])%MOD*num[x][2])%MOD;
				temp-=(((1LL*num[y][0])%MOD*num[y][1])%MOD*num[y][2])%MOD;
				fa[y]=x;
				num[x][0]+=num[y][0];
				num[x][1]+=num[y][1];
				num[x][2]+=num[y][2];
				//printf("%d %d %d\n",num[x][0],num[x][1],num[x][2]);
				temp+=(((1LL*num[x][0])%MOD*num[x][1])%MOD*num[x][2])%MOD;
			}
			ans[i]=temp;
		}
		for(i=1;i<minlen;i++)printf("%I64d ",ans[i]);
		printf("%I64d\n",ans[i]);
	}
}


#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
#include <vector>
//#include <queue>
//#include <list>
//#include <map>
//#include <set>
#include <string.h>
#include <math.h>
//double PI=acos(-1.0);

#define oo 0x7fffffff
#define ooll 0x7fffffffffffffffLL
#define ll __int64
#define MOD  1000000007

#define NN 311111
#define SIZZ 256
#define F(x) ((x)/3+((x)%3==1?0:tb))
#define G(x) ((x)<tb?(x)*3+1:((x)-tb)*3+2)

int aa[3*NN],bb[NN],cc[NN],xx[NN],yy[NN];
int sa[3*NN],height[NN],rank[NN];
int hf[NN][20];
char s[NN];
int c0(int *r,int a,int b){
	return r[a]==r[b]&&r[a+1]==r[b+1]&&r[a+2]==r[b+2];
}
int c12(int k,int *r,int a,int b){
	if(k==2)return r[a]<r[b]||r[a]==r[b]&&c12(1,r,a+1,b+1);
	else return r[a]<r[b]||r[a]==r[b]&&cc[a+1]<cc[b+1];
}
void sort(int *r,int *a,int *b,int n,int m){
	int i;
	for(i=0;i<n;i++)cc[i]=r[a[i]];
	for(i=0;i<m;i++)bb[i]=0;
	for(i=0;i<n;i++)bb[cc[i]]++;
	for(i=1;i<m;i++)bb[i]+=bb[i-1];
	for(i=n-1;i>=0;i--)b[--bb[cc[i]]]=a[i];
}
void dc3(int *r,int *sa,int n,int m){
	int i,j,ta=0,tb=(n+1)/3,tc=0,p;
	int *rn=r+n,*sn=sa+n;
	r[n]=r[n+1]=0;
	for(i=0;i<n;i++)if(i%3!=0)xx[tc++]=i;
	sort(r+2,xx,yy,tc,m);
	sort(r+1,yy,xx,tc,m);
	sort(r,xx,yy,tc,m);
	for(p=1,rn[F(yy[0])]=0,i=1;i<tc;i++)
	rn[F(yy[i])]=c0(r,yy[i-1],yy[i])?p-1:p++;
	if(p<tc)dc3(rn,sn,tc,p);
	else for(i=0;i<tc;i++)sn[rn[i]]=i;
	for(i=0;i<tc;i++)if(sn[i]<tb)yy[ta++]=sn[i]*3;
	if(n%3==1)yy[ta++]=n-1;
	sort(r,yy,xx,ta,m);
	for(i=0;i<tc;i++)cc[yy[i]=G(sn[i])]=i;
	for(i=0,j=0,p=0;i<ta&&j<tc;p++)
	sa[p]=c12(yy[j]%3,r,xx[i],yy[j])?xx[i++]:yy[j++];
	for(;i<ta;p++)sa[p]=xx[i++];
	for(;j<tc;p++)sa[p]=yy[j++];
}
void calh(int n){
	int i,j,k=0;
	for(i=0;i<n;i++)rank[sa[i]]=i;
	for(i=0;i<n;i++){
		if(k)k--;
		j=sa[rank[i]-1];
		if(rank[i]-1<0)continue;
		while(i+k<n-1&&j+k<n-1&&aa[i+k]==aa[j+k])k++;
		height[rank[i]]=k;
	}
}
vector < pair<int,int> > co[NN];
int fa[NN];
int find(int x){
	return x==fa[x]?x:fa[x]=find(fa[x]);
}
int num[NN][3];
ll ans[NN];
main(){
	int i,j,n=0,top,K;
	int len[3];

	n=0;
	memset(num,0,sizeof(num));
	int minlen=oo;
	for(i=0;i<3;i++){
		scanf("%s",s);
		len[i]=strlen(s);
		if(len[i]<minlen)minlen=len[i];
		for(j=0;j<len[i];j++){
			aa[n++]=s[j];
			num[n-1][i]=1;
		}
		aa[n++]=SIZZ+i;
		num[n-1][i]=1;
	}
	for(i=0;i<n;i++){
		fa[i]=i;
		co[i].clear();
	}
	dc3(aa,sa,n,SIZZ+10);
	calh(n);
	for(i=1;i<n;i++)co[height[i]].push_back(make_pair(sa[i],sa[i-1]));
	ll temp=0;
	for(i=n;i>=1;i--){
		int size=co[i].size();
		for(j=0;j<size;j++){
			int s1=co[i][j].first;
			int s2=co[i][j].second;
			int x=find(s1);
			int y=find(s2);
			if(x!=y){
				temp-=1LL*num[x][0]*num[x][1]*num[x][2];
				temp-=1LL*num[y][0]*num[y][1]*num[y][2];
				fa[y]=x;
				num[x][0]+=num[y][0];
				num[x][1]+=num[y][1];
				num[x][2]+=num[y][2];
				temp+=(1LL*num[x][0]*num[x][1]*num[x][2])%MOD;
			}
		}
		ans[i]=temp;
	}
	for(i=1;i<minlen;i++)printf("%I64d ",ans[i]%MOD);
	printf("%I64d\n",ans[minlen]%MOD);

}


#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
#include <vector>
//#include <queue>
//#include <list>
//#include <map>
//#include <set>
#include <string.h>
#include <math.h>
//double PI=acos(-1.0);

#define oo 0x7fffffff
#define ooll 0x7fffffffffffffffLL
#define ll __int64
#define MOD  1000000007

#define NN 311111
#define SIZZ 256
#define F(x) ((x)/3+((x)%3==1?0:tb))
#define G(x) ((x)<tb?(x)*3+1:((x)-tb)*3+2)

int aa[3*NN],bb[NN],cc[NN],xx[NN],yy[NN];
int sa[3*NN],height[NN],rank[NN];
int hf[NN][20];
char s[NN];
int c0(int *r,int a,int b){
	return r[a]==r[b]&&r[a+1]==r[b+1]&&r[a+2]==r[b+2];
}
int c12(int k,int *r,int a,int b){
	if(k==2)return r[a]<r[b]||r[a]==r[b]&&c12(1,r,a+1,b+1);
	else return r[a]<r[b]||r[a]==r[b]&&cc[a+1]<cc[b+1];
}
void sort(int *r,int *a,int *b,int n,int m){
	int i;
	for(i=0;i<n;i++)cc[i]=r[a[i]];
	for(i=0;i<m;i++)bb[i]=0;
	for(i=0;i<n;i++)bb[cc[i]]++;
	for(i=1;i<m;i++)bb[i]+=bb[i-1];
	for(i=n-1;i>=0;i--)b[--bb[cc[i]]]=a[i];
}
void dc3(int *r,int *sa,int n,int m){
	int i,j,ta=0,tb=(n+1)/3,tc=0,p;
	int *rn=r+n,*sn=sa+n;
	r[n]=r[n+1]=0;
	for(i=0;i<n;i++)if(i%3!=0)xx[tc++]=i;
	sort(r+2,xx,yy,tc,m);
	sort(r+1,yy,xx,tc,m);
	sort(r,xx,yy,tc,m);
	for(p=1,rn[F(yy[0])]=0,i=1;i<tc;i++)
	rn[F(yy[i])]=c0(r,yy[i-1],yy[i])?p-1:p++;
	if(p<tc)dc3(rn,sn,tc,p);
	else for(i=0;i<tc;i++)sn[rn[i]]=i;
	for(i=0;i<tc;i++)if(sn[i]<tb)yy[ta++]=sn[i]*3;
	if(n%3==1)yy[ta++]=n-1;
	sort(r,yy,xx,ta,m);
	for(i=0;i<tc;i++)cc[yy[i]=G(sn[i])]=i;
	for(i=0,j=0,p=0;i<ta&&j<tc;p++)
	sa[p]=c12(yy[j]%3,r,xx[i],yy[j])?xx[i++]:yy[j++];
	for(;i<ta;p++)sa[p]=xx[i++];
	for(;j<tc;p++)sa[p]=yy[j++];
}
void calh(int n){
	int i,j,k=0;
	for(i=0;i<n;i++)rank[sa[i]]=i;
	for(i=0;i<n;i++){
		if(k)k--;
		j=sa[rank[i]-1];
		if(rank[i]-1<0)continue;
		while(i+k<n-1&&j+k<n-1&&aa[i+k]==aa[j+k])k++;
		height[rank[i]]=k;
	}
}
vector < pair<int,int> > co[NN];
int fa[NN];
int find(int x){
	return x==fa[x]?x:fa[x]=find(fa[x]);
}
int num[NN][3];
ll ans[NN];
main(){
	int i,j,n=0,top,K;
	int len[3];

	n=0;
	memset(num,0,sizeof(num));
	int minlen=oo;
	for(i=0;i<3;i++){
		scanf("%s",s);
		len[i]=strlen(s);
		if(len[i]<minlen)minlen=len[i];
		for(j=0;j<len[i];j++){
			aa[n++]=s[j];
			num[n-1][i]=1;
		}
		aa[n++]=SIZZ+i;
		num[n-1][i]=1;
	}
	for(i=0;i<n;i++){
		fa[i]=i;
		co[i].clear();
	}
	dc3(aa,sa,n,SIZZ+10);
	calh(n);
	for(i=1;i<n;i++)co[height[i]].push_back(make_pair(sa[i],sa[i-1]));
	ll temp=0;
	for(i=n;i>=1;i--){
		int size=co[i].size();
		for(j=0;j<size;j++){
			int s1=co[i][j].first;
			int s2=co[i][j].second;
			int x=find(s1);
			int y=find(s2);
			if(x!=y){
				temp-=1LL*num[x][0]*num[x][1]*num[x][2];
				temp-=1LL*num[y][0]*num[y][1]*num[y][2];
				fa[y]=x;
				num[x][0]+=num[y][0];
				num[x][1]+=num[y][1];
				num[x][2]+=num[y][2];
				temp+=1LL*num[x][0]*num[x][1]*num[x][2];
				temp%=MOD;
			}
		}
		ans[i]=temp;
	}
	for(i=1;i<minlen;i++)printf("%I64d ",ans[i]%MOD);
	printf("%I64d\n",ans[minlen]%MOD);

}


#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#define For(i,a,n) for(int i=(a);i<=(n);i++)
#define limit 600005
#define mo 1000000007
using namespace std;

int Ch='z'-'a'+1,ts,prets,L=210000000;
int ord[limit],t[limit];
int s[limit];
long long Tre[limit];

void Add(int x,long long y){
	if(x>L)return;
	if(!x)return;
	Tre[x]+=y;
	Tre[x]%=mo;
}

struct SAM
{
	int dex,last,root;
	int tree[limit][30],pre[limit],col[limit];
	int sz[5][limit],step[limit],ok[limit];
	void init()
	{
		memset(tree,0,sizeof(tree));
		memset(pre,0,sizeof(pre));
		memset(sz,0,sizeof(sz));
		memset(step,0,sizeof(step));
		memset(ok,0,sizeof(ok));
		memset(col,0,sizeof(col));
		dex=last=root=1;
	}
	void expend(int x,int color)
	{
		int p,q=last,skydec=(++dex);
		step[skydec]=step[q]+1;
		col[skydec]=color;
		for(p=q;p&&!tree[p][x];p=pre[p])
			tree[p][x]=skydec;
		if(!p)pre[skydec]=1;
		else
		{
			int gt=tree[p][x];
			if(step[p]+1==step[gt])pre[skydec]=gt;
			else
			{
				int nq=(++dex);
				col[nq]=col[gt];
				pre[nq]=pre[gt];
				pre[gt]=pre[skydec]=nq;
				step[nq]=step[p]+1;
				memcpy(tree[nq],tree[gt],sizeof(tree[gt]));
				for(int z=p;z&&tree[z][x]==gt;z=pre[z])
					tree[z][x]=nq;
			}
		}last=skydec;
	}
	void findtop()
	{
		for(int i=1;i<=dex;i++)t[step[i]]++;
		for(int i=1;i<=dex;i++)t[i]+=t[i-1];
		for(int i=1;i<=dex;i++)
			ord[t[step[i]]--]=i;
	}
	void getrightsize()
	{
		int lv=1;
		for(int i=1,p=1;i<=ts;i++)
		{
			p=tree[p][s[i]];
			if(s[i]==26) lv++;
			sz[lv][p]++;
		}
		for(int i=dex;i;i--){
			int mm=ord[i];
			if(!pre[mm])continue;
			For(j,1,3) sz[j][pre[mm]]+=sz[j][mm];
		}
	}
	long long count(int x){
		long long rs=1;
		For(j,1,3) rs=(1ll*rs*sz[j][x])%mo;
		return rs;
	}
	void work(){
		For(i,1,dex)
		if(col[i]==1){
			long long t=count(i);
			Add(step[pre[i]]+1,t);
			Add(step[i]+1,-t);
		}
	}
}sam;

int main(){
	sam.init();
	char ch=getchar();
	int lv=1;
	while(ch!=-1){
		if(ch>='a'&&ch<='z')sam.expend(ch-'a',lv),s[++ts]=ch-'a';
		else{
			if(lv<=2)sam.expend(26,0);
			L=min(L,ts-prets);s[++ts]=26;
			prets=ts;
			++lv;
			if(lv>3)break;
		}
		ch=getchar();
	}--ts;
	sam.findtop();
	sam.getrightsize();
	sam.work();
	For(i,1,L) Tre[i]=(Tre[i]+Tre[i-1])%mo;
	For(i,1,L) if(Tre[i]<0) Tre[i]+=mo;
	For(i,1,L)printf("%I64d ",Tre[i]);
}


#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#define For(i,a,n) for(int i=(a);i<=(n);i++)
#define limit 600005
#define mo 1000000007
using namespace std;

int Ch='z'-'a'+1,ts,prets,L=210000000;
int ord[limit],t[limit];
int s[limit];
long long Tre[limit];

void Add(int x,long long y){
	if(x>L)return;
	Tre[x]+=y;
	Tre[x]%=mo;
}

struct SAM
{
	int dex,last,root;
	int tree[limit][30],pre[limit],col[limit];
	int sz[5][limit],step[limit],ok[limit];
	void init()
	{
		memset(tree,0,sizeof(tree));
		memset(pre,0,sizeof(pre));
		memset(sz,0,sizeof(sz));
		memset(step,0,sizeof(step));
		memset(ok,0,sizeof(ok));
		dex=last=root=1;
	}
	void expend(int x,int color)
	{
		if(color==3&&x==1)
			x=1;
		int p,q=last,skydec=(++dex);
		step[skydec]=step[q]+1;
		col[skydec]=color;
		for(p=q;p&&!tree[p][x];p=pre[p])
			tree[p][x]=skydec;
		if(!p)pre[skydec]=1;
		else
		{
			int gt=tree[p][x];
			if(step[p]+1==step[gt])pre[skydec]=gt;
			else
			{
				int nq=(++dex);
				col[nq]=col[gt];
				pre[nq]=pre[gt];
				pre[gt]=pre[skydec]=nq;
				step[nq]=step[p]+1;
				memcpy(tree[nq],tree[gt],sizeof(tree[gt]));
				for(int z=p;z&&tree[z][x]==gt;z=pre[z])
					tree[z][x]=nq;
			}
		}last=skydec;
	}
	void findtop()
	{
		for(int i=1;i<=dex;i++)t[step[i]]++;
		for(int i=1;i<=dex;i++)t[i]+=t[i-1];
		for(int i=1;i<=dex;i++)
			ord[t[step[i]]--]=i;
	}
	void getrightsize()
	{
		int lv=1;
		for(int i=1,p=1;i<=ts;i++)
		{
			p=tree[p][s[i]];
			if(s[i]==26) lv++;
			sz[lv][p]++;
		}
		for(int i=dex;i;i--){
			int mm=ord[i];
			if(mm==14)
				mm=14;
			if(!pre[mm])continue;
			For(j,1,3) sz[j][pre[mm]]+=sz[j][mm];
		}
	}
	long long count(int x){
		long long rs=1;
		For(j,1,3) rs=(1ll*rs*sz[j][x])%mo;
		return rs;
	}
	void work(){
		For(i,1,dex)
		if(col[i]==1){
			long long t=count(i);
			if(pre[i])Add(step[pre[i]]+1,t);
			Add(step[i]+1,-t);
		}
	}
}sam;

int main(){
	sam.init();
	char ch=getchar();
	int lv=1;
	while(ch!=-1){
		if(ch>='a'&&ch<='z')sam.expend(ch-'a',lv),s[++ts]=ch-'a';
		else{
			if(lv<=2)sam.expend(26,0);
			L=min(L,ts-prets);s[++ts]=26;
			prets=ts;
			++lv;
			if(lv>3)break;
		}
		ch=getchar();
	}--ts;
	sam.findtop();
	sam.getrightsize();
	sam.work();
	For(i,1,L) Tre[i]=(Tre[i]+Tre[i-1])%mo;
	For(i,1,L)printf("%I64d ",Tre[i]);
}


/*=============================================================================
#  Author:Erich
#  FileName:
=============================================================================*/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#define lson id<<1,l,m
#define rson id<<1|1,m+1,r

using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
const ll INF=1ll<<60;
const double PI=acos(-1.0);
const int maxn=505000;
const int mod=1e9+7;
char ss[maxn];
int belong[maxn];
int s[maxn],rs[maxn];
int sa[maxn],t[maxn],t2[maxn],c[maxn];
int n,m,k,tt;
int rank[maxn],height[maxn];
int len,l;
inline int idx(char c)
{
    return c-'a'+3;
}
inline char fdx(int x)
{
    return char(x-3+'a');
}
void getheight(int n)
{
    int i,j,k=0;
    for (i=0; i<=n; i++) rank[sa[i]]=i;

    for (i=0; i<n; i++)
    {
        if (k) k--;
        int j=sa[rank[i]-1];
        while(s[i+k]==s[j+k]) k++;
        height[rank[i]]=k;
    }
}
void build_ss(int m,int n)
{
    n++;
    int i,*x=t,*y=t2;
    for (int i=0; i<m; i++) c[i]=0;
    for (int i=0; i<n; i++) c[x[i]=s[i]]++;
    for (int i=1; i<m; i++) c[i]+=c[i-1];
    for (int i=n-1; i>=0; i--)
      sa[--c[x[i]]]=i;
    for (int k=1; k<=n; k<<=1)
    {
        int p=0;
        for (i=n-k; i<n; i++) y[p++]=i;
        for (i=0; i<n; i++) if (sa[i]>=k) y[p++]=sa[i]-k;

        for (i=0; i<m; i++) c[i]=0;
        for (i=0; i<n; i++) c[x[y[i]]]++;
        for (i=1; i<m; i++) c[i]+=c[i-1];
        for (i=n-1; i>=0; i--) sa[--c[x[y[i]]]] = y[i];
        swap(x,y);
        p=1;
        x[sa[0]]=0;
        for (i=1; i<n; i++)
        x[sa[i]]=(y[sa[i-1]]==y[sa[i]] && y[sa[i-1]+k]==y[sa[i]+k])? p-1 : p++;
        if (p>=n) break;
        m=p;
    }
}
void print(int x)
{
    for (int i=x; i<=n; i++)
    if (s[i]>2)cout<<fdx(s[i]);
    else cout<<s[i];
    cout<<endl;
}
ll ans[maxn];
ll sum[5][maxn];
ll find(int l,int r)
{

    ll x0=sum[0][r]-sum[0][l-2];
    ll x1=sum[1][r]-sum[1][l-2];
    ll x2=sum[2][r]-sum[2][l-2];
    return (x0%mod*x1%mod*x2%mod)%mod;
}
int main()
{
//  freopen("in.txt","r",stdin);
    while(~scanf("%s",&ss))
    {
        l=strlen(ss);
        len=l;
        n=0;
        for (int i=0; i<l;i++)  belong[n]=0,s[n++]=idx(ss[i]);
        belong[n]=-1;s[n++]=1;
        scanf("%s",&ss); l=strlen(ss);
        len=min(len,l);
        for (int i=0; i<l; i++) belong[n]=1,s[n++]=idx(ss[i]);
        belong[n]=-1;s[n++]=2;
        scanf("%s",&ss); l=strlen(ss);
        len=min(len,l);
        for (int i=0; i<l; i++) belong[n]=2,s[n++]=idx(ss[i]);
        belong[n]=-1;s[n]=0;
        build_ss(33,n);
        getheight(n);

//  for (int i=0; i<=n; i++)
//      print(sa[i]);

        vector<int> v[3];
        memset(ans,0,sizeof ans);
        memset(sum,0,sizeof sum);
        int id;
        for (int i=0; i<=n; i++)
        {
            sum[0][i]=sum[0][i-1];
            sum[1][i]=sum[1][i-1];
            sum[2][i]=sum[2][i-1];
            if (belong[sa[i]]!=-1)
            {
                id=belong[sa[i]];
                sum[id][i]++;
            }
        }
        ll tmp=0;
        int p=0;
        for (int i=0; i<=n; i++)
            if (height[i])  v[p].push_back(i);
        int i=1;
        int last=0;
        while (i<=len)
        {
            int mi=len+1;
            if (v[p].size()==0) break;
            tmp=0;
            int l=v[p][0],r=v[p][0];
            if (height[v[p][0]]>i) v[p^1].push_back(v[p][0]);
            for (int j=1; j<v[p].size(); j++)
            {
                if (v[p][j]>v[p][j-1]+1 || height[v[p][j]]<i)
                {
                    tmp+=find(l,r);
                    tmp%=mod;
                    l=v[p][j]; r=l;
                }
                else r=v[p][j];
                if (height[v[p][j]]>i) v[p^1].push_back(v[p][j]),mi=min(mi,height[v[p][j]]);
            }
            tmp+=find(l,r);
            tmp%=mod;
            ans[last+1]+=tmp;
            ans[i+1]-=tmp;
            ans[last+1]%=mod;
            ans[i+1]=((ans[i+1]%mod)+mod)%mod;
            if (tmp==0) break;
            v[p].clear();
            p=p^1;
            last=i;
            i=mi;
        }
        for (int i=1; i<=len;i++)
            ans[i]=ans[i-1]+ans[i],ans[i]%=mod;
        for (int i=1; i<=len; i++)
            cout<<ans[i]<<" ";
        cout<<endl;

    }
    return 0;
}


/*=============================================================================
#  Author:Erich
#  FileName:
=============================================================================*/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#define lson id<<1,l,m
#define rson id<<1|1,m+1,r

using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
const ll INF=1ll<<60;
const double PI=acos(-1.0);
const int maxn=505000;
const int mod=1e9+7;
char ss[maxn];
int belong[maxn];
int s[maxn],rs[maxn];
int sa[maxn],t[maxn],t2[maxn],c[maxn];
int n,m,k,tt;
int rank[maxn],height[maxn];
int len,l;
inline int idx(char c)
{
    return c-'a'+3;
}
inline char fdx(int x)
{
    return char(x-3+'a');
}
void getheight(int n)
{
    int i,j,k=0;
    for (i=0; i<=n; i++) rank[sa[i]]=i;

    for (i=0; i<n; i++)
    {
        if (k) k--;
        int j=sa[rank[i]-1];
        while(s[i+k]==s[j+k]) k++;
        height[rank[i]]=k;
    }
}
void build_ss(int m,int n)
{
    n++;
    int i,*x=t,*y=t2;
    for (int i=0; i<m; i++) c[i]=0;
    for (int i=0; i<n; i++) c[x[i]=s[i]]++;
    for (int i=1; i<m; i++) c[i]+=c[i-1];
    for (int i=n-1; i>=0; i--)
      sa[--c[x[i]]]=i;
    for (int k=1; k<=n; k<<=1)
    {
        int p=0;
        for (i=n-k; i<n; i++) y[p++]=i;
        for (i=0; i<n; i++) if (sa[i]>=k) y[p++]=sa[i]-k;

        for (i=0; i<m; i++) c[i]=0;
        for (i=0; i<n; i++) c[x[y[i]]]++;
        for (i=1; i<m; i++) c[i]+=c[i-1];
        for (i=n-1; i>=0; i--) sa[--c[x[y[i]]]] = y[i];
        swap(x,y);
        p=1;
        x[sa[0]]=0;
        for (i=1; i<n; i++)
        x[sa[i]]=(y[sa[i-1]]==y[sa[i]] && y[sa[i-1]+k]==y[sa[i]+k])? p-1 : p++;
        if (p>=n) break;
        m=p;
    }
}
void print(int x)
{
    for (int i=x; i<=n; i++)
    if (s[i]>2)cout<<fdx(s[i]);
    else cout<<s[i];
    cout<<endl;
}
ll ans[maxn];
ll sum[4][maxn];
int fa[maxn];
struct node
{
    int pos,h;
    node(){
    }
    node(int x,int y)
    {
        pos=x; h=y;
    }
    bool operator<(const node&p) const
    {
        return h<p.h;
    }
};
int find(int x)
{
    if (fa[x]==x) return x;
    return fa[x]=find(fa[x]);
}
bool cmp(int x,int y)
{
    return height[x]>height[y];
}
int p[maxn];

int main()
{
    //freopen("in.txt","r",stdin);
    while(~scanf("%s",&ss))
    {
        l=strlen(ss);
        len=l;
        n=0;
        for (int i=0; i<l;i++)  belong[n]=0,s[n++]=idx(ss[i]);
        belong[n]=-1;s[n++]=1;
        scanf("%s",&ss); l=strlen(ss);
        len=min(len,l);
        for (int i=0; i<l; i++) belong[n]=1,s[n++]=idx(ss[i]);
        belong[n]=-1;s[n++]=2;
        scanf("%s",&ss); l=strlen(ss);
        len=min(len,l);
        for (int i=0; i<l; i++) belong[n]=2,s[n++]=idx(ss[i]);
        belong[n]=-1;s[n]=0;
        build_ss(33,n);
        getheight(n);

//  for (int i=0; i<=n; i++)
//      print(sa[i]);
    //  for (int i=1; i<=n; i++) printf("%d%s",height[i],i==n?"\n":" ");
        for (int i=0; i<=n; i++) p[i]=i,fa[i]=i;
        memset(sum,0,sizeof sum);
        sort(p+1,p+1+n,cmp);
        for (int i=0; i<=n; i++)
        {
            sum[0][i]=sum[1][i]=sum[2][i]=0;
            if (belong[i]==0) sum[0][i]=1;
            if (belong[i]==1) sum[1][i]=1;
            if (belong[i]==2) sum[2][i]=1;
        }
        int j=1;
        ll tmp=0;
        memset(ans,0,sizeof ans);
        for (int i=len; i>=1; i--)
        {

            while(j<=n && height[p[j]]>=i)
            {
                int le=find(sa[p[j]-1]),ri=find(sa[p[j]]);
                tmp=tmp-(sum[0][le]%mod*sum[1][le]%mod*sum[2][le]%mod);
                tmp=((tmp%mod)+mod)%mod;
                    tmp=tmp-(sum[0][ri]%mod*sum[1][ri]%mod*sum[2][ri]%mod);
                tmp=((tmp%mod)+mod)%mod;
                sum[0][le]+=sum[0][ri];
                sum[1][le]+=sum[1][ri];
                sum[2][le]+=sum[2][ri];
                tmp=tmp+(sum[0][le]%mod*sum[1][le]%mod*sum[2][le]%mod);
                tmp%=mod;
                fa[ri]=le;
                j++;
            }
            ans[i]=tmp;
        }
        for (int i=1; i<=len; i++)
            cout<<ans[i]<<" ";
        cout<<endl;
    }
    return 0;
}


/*=============================================================================
#  Author:Erich
#  FileName:
=============================================================================*/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#define lson id<<1,l,m
#define rson id<<1|1,m+1,r

using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
const ll INF=1ll<<60;
const double PI=acos(-1.0);
const int maxn=505000;
const int mod=1e9+7;
char ss[maxn];
int belong[maxn];
int s[maxn],rs[maxn];
int sa[maxn],t[maxn],t2[maxn],c[maxn];
int n,m,k,tt;
int rank[maxn],height[maxn];
int len,l;
inline int idx(char c)
{
	return c-'a'+3;
}
inline char fdx(int x)
{
	return char(x-3+'a');
}
void getheight(int n)
{
    int i,j,k=0;
    for (i=0; i<=n; i++) rank[sa[i]]=i;

    for (i=0; i<n; i++)
    {
        if (k) k--;
        int j=sa[rank[i]-1];
        while(s[i+k]==s[j+k]) k++;
        height[rank[i]]=k;
    }
}
void build_ss(int m,int n)
{
    n++;
    int i,*x=t,*y=t2;
    for (int i=0; i<m; i++) c[i]=0;
    for (int i=0; i<n; i++) c[x[i]=s[i]]++;
    for (int i=1; i<m; i++) c[i]+=c[i-1];
    for (int i=n-1; i>=0; i--)
      sa[--c[x[i]]]=i;
    for (int k=1; k<=n; k<<=1)
    {
        int p=0;
        for (i=n-k; i<n; i++) y[p++]=i;
        for (i=0; i<n; i++) if (sa[i]>=k) y[p++]=sa[i]-k;

        for (i=0; i<m; i++) c[i]=0;
        for (i=0; i<n; i++) c[x[y[i]]]++;
        for (i=1; i<m; i++) c[i]+=c[i-1];
        for (i=n-1; i>=0; i--) sa[--c[x[y[i]]]] = y[i];
        swap(x,y);
        p=1;
        x[sa[0]]=0;
        for (i=1; i<n; i++)
        x[sa[i]]=(y[sa[i-1]]==y[sa[i]] && y[sa[i-1]+k]==y[sa[i]+k])? p-1 : p++;
        if (p>=n) break;
        m=p;
    }
}
void print(int x)
{
	for (int i=x; i<=n; i++)
	if (s[i]>2)cout<<fdx(s[i]);
	else cout<<s[i];
	cout<<endl;
}
ll ans[maxn];
ll sum[5][maxn];
ll find(int l,int r)
{

	ll x0=sum[0][r]-sum[0][l-2];
	ll x1=sum[1][r]-sum[1][l-2];
	ll x2=sum[2][r]-sum[2][l-2];
	return (x0%mod*x1%mod*x2%mod)%mod;
}
int main()
{
	//freopen("in.txt","r",stdin);
	while(~scanf("%s",&ss))
	{
		l=strlen(ss);
		len=l;
		n=0;
		for (int i=0; i<l;i++)	belong[n]=0,s[n++]=idx(ss[i]);
		belong[n]=-1;s[n++]=1;
		scanf("%s",&ss); l=strlen(ss);
		len=min(len,l);
		for (int i=0; i<l; i++) belong[n]=1,s[n++]=idx(ss[i]);
		belong[n]=-1;s[n++]=2;
		scanf("%s",&ss); l=strlen(ss);
		len=min(len,l);
		for (int i=0; i<l; i++) belong[n]=2,s[n++]=idx(ss[i]);
		belong[n]=-1;s[n]=0;
		build_ss(33,n);
		getheight(n);

//	for (int i=0; i<=n; i++)
//		print(sa[i]);

		vector<int> v[3];
		memset(ans,0,sizeof ans);
		memset(sum,0,sizeof sum);
		int id;
		for (int i=0; i<=n; i++)
		{
			sum[0][i]=sum[0][i-1];
			sum[1][i]=sum[1][i-1];
			sum[2][i]=sum[2][i-1];
			if (belong[sa[i]]!=-1)
			{
				id=belong[sa[i]];
				sum[id][i]++;
			}
		}
		ll tmp=0;
		int p=0;
		for (int i=0; i<=n; i++)
			if (height[i])	v[p].push_back(i);

		for (int i=1; i<=len; i++)
		{
			tmp=0;
			int l=v[p][0],r=v[p][0];
			if (height[v[p][0]]>i) v[p^1].push_back(v[p][0]);
			for (int j=1; j<v[p].size(); j++)
			{
				if (v[p][j]>v[p][j-1]+1 || height[v[p][j]]<i)
				{
					tmp+=find(l,r);
					tmp%=mod;
					l=v[p][j]; r=l;
				}
				else r=v[p][j];
				if (height[v[p][j]]>i) v[p^1].push_back(v[p][j]);
			}
			tmp+=find(l,r);
			ans[i]=tmp;
			if (tmp==0) break;
			v[p].clear();
			p=p^1;
		}
		for (int i=1; i<=len; i++)
			cout<<ans[i]<<" ";
		cout<<endl;

	}
	return 0;
}


/*=============================================================================
#  Author:Erich
#  FileName:
=============================================================================*/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#define lson id<<1,l,m
#define rson id<<1|1,m+1,r

using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
const ll INF=1ll<<60;
const double PI=acos(-1.0);
const int maxn=505000;
const int mod=1e9+7;
char ss[maxn];
int belong[maxn];
int s[maxn],rs[maxn];
int sa[maxn],t[maxn],t2[maxn],c[maxn];
int n,m,k,tt;
int rank[maxn],height[maxn];
int len,l;
inline int idx(char c)
{
    return c-'a'+3;
}
inline char fdx(int x)
{
    return char(x-3+'a');
}
void getheight(int n)
{
    int i,j,k=0;
    for (i=0; i<=n; i++) rank[sa[i]]=i;

    for (i=0; i<n; i++)
    {
        if (k) k--;
        int j=sa[rank[i]-1];
        while(s[i+k]==s[j+k]) k++;
        height[rank[i]]=k;
    }
}
void build_ss(int m,int n)
{
    n++;
    int i,*x=t,*y=t2;
    for (int i=0; i<m; i++) c[i]=0;
    for (int i=0; i<n; i++) c[x[i]=s[i]]++;
    for (int i=1; i<m; i++) c[i]+=c[i-1];
    for (int i=n-1; i>=0; i--)
      sa[--c[x[i]]]=i;
    for (int k=1; k<=n; k<<=1)
    {
        int p=0;
        for (i=n-k; i<n; i++) y[p++]=i;
        for (i=0; i<n; i++) if (sa[i]>=k) y[p++]=sa[i]-k;

        for (i=0; i<m; i++) c[i]=0;
        for (i=0; i<n; i++) c[x[y[i]]]++;
        for (i=1; i<m; i++) c[i]+=c[i-1];
        for (i=n-1; i>=0; i--) sa[--c[x[y[i]]]] = y[i];
        swap(x,y);
        p=1;
        x[sa[0]]=0;
        for (i=1; i<n; i++)
        x[sa[i]]=(y[sa[i-1]]==y[sa[i]] && y[sa[i-1]+k]==y[sa[i]+k])? p-1 : p++;
        if (p>=n) break;
        m=p;
    }
}
void print(int x)
{
    for (int i=x; i<=n; i++)
    if (s[i]>2)cout<<fdx(s[i]);
    else cout<<s[i];
    cout<<endl;
}
ll ans[maxn];
ll sum[5][maxn];
ll find(int l,int r)
{

    ll x0=sum[0][r]-sum[0][l-2];
    ll x1=sum[1][r]-sum[1][l-2];
    ll x2=sum[2][r]-sum[2][l-2];
    return (x0%mod*x1%mod*x2%mod)%mod;
}
int main()
{
//  freopen("in.txt","r",stdin);
    while(~scanf("%s",&ss))
    {
        l=strlen(ss);
        len=l;
        n=0;
        for (int i=0; i<l;i++)  belong[n]=0,s[n++]=idx(ss[i]);
        belong[n]=-1;s[n++]=1;
        scanf("%s",&ss); l=strlen(ss);
        len=min(len,l);
        for (int i=0; i<l; i++) belong[n]=1,s[n++]=idx(ss[i]);
        belong[n]=-1;s[n++]=2;
        scanf("%s",&ss); l=strlen(ss);
        len=min(len,l);
        for (int i=0; i<l; i++) belong[n]=2,s[n++]=idx(ss[i]);
        belong[n]=-1;s[n]=0;
        build_ss(33,n);
        getheight(n);

//  for (int i=0; i<=n; i++)
//      print(sa[i]);

        vector<int> v[3];
        memset(ans,0,sizeof ans);
        memset(sum,0,sizeof sum);
        int id;
        for (int i=0; i<=n; i++)
        {
            sum[0][i]=sum[0][i-1];
            sum[1][i]=sum[1][i-1];
            sum[2][i]=sum[2][i-1];
            if (belong[sa[i]]!=-1)
            {
                id=belong[sa[i]];
                sum[id][i]++;
            }
        }
        ll tmp=0;
        int p=0;
        for (int i=0; i<=n; i++)
            if (height[i])  v[p].push_back(i);

        for (int i=1; i<=len; i++)
        {
            if (v[p].size()==0) break;
            tmp=0;
            int l=v[p][0],r=v[p][0];
            if (height[v[p][0]]>i) v[p^1].push_back(v[p][0]);
            for (int j=1; j<v[p].size(); j++)
            {
                if (v[p][j]>v[p][j-1]+1 || height[v[p][j]]<i)
                {
                    tmp+=find(l,r);
                    tmp%=mod;
                    l=v[p][j]; r=l;
                }
                else r=v[p][j];
                if (height[v[p][j]]>i) v[p^1].push_back(v[p][j]);
            }
            tmp+=find(l,r);
            tmp%=mod;
            ans[i]=tmp;
            if (tmp==0) break;
            v[p].clear();
            p=p^1;
        }
        for (int i=1; i<=len; i++)
            cout<<ans[i]<<" ";
        cout<<endl;

    }
    return 0;
}


/*=============================================================================
#  Author:Erich
#  FileName:
=============================================================================*/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#define lson id<<1,l,m
#define rson id<<1|1,m+1,r

using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
const ll INF=1ll<<60;
const double PI=acos(-1.0);
const int maxn=505000;
const int mod=1e9+7;
char ss[maxn];
int belong[maxn];
int s[maxn],rs[maxn];
int sa[maxn],t[maxn],t2[maxn],c[maxn];
int n,m,k,tt;
int rank[maxn],height[maxn];
int len,l;
inline int idx(char c)
{
    return c-'a'+3;
}
inline char fdx(int x)
{
    return char(x-3+'a');
}
void getheight(int n)
{
    int i,j,k=0;
    for (i=0; i<=n; i++) rank[sa[i]]=i;

    for (i=0; i<n; i++)
    {
        if (k) k--;
        int j=sa[rank[i]-1];
        while(s[i+k]==s[j+k]) k++;
        height[rank[i]]=k;
    }
}
void build_ss(int m,int n)
{
    n++;
    int i,*x=t,*y=t2;
    for (int i=0; i<m; i++) c[i]=0;
    for (int i=0; i<n; i++) c[x[i]=s[i]]++;
    for (int i=1; i<m; i++) c[i]+=c[i-1];
    for (int i=n-1; i>=0; i--)
      sa[--c[x[i]]]=i;
    for (int k=1; k<=n; k<<=1)
    {
        int p=0;
        for (i=n-k; i<n; i++) y[p++]=i;
        for (i=0; i<n; i++) if (sa[i]>=k) y[p++]=sa[i]-k;

        for (i=0; i<m; i++) c[i]=0;
        for (i=0; i<n; i++) c[x[y[i]]]++;
        for (i=1; i<m; i++) c[i]+=c[i-1];
        for (i=n-1; i>=0; i--) sa[--c[x[y[i]]]] = y[i];
        swap(x,y);
        p=1;
        x[sa[0]]=0;
        for (i=1; i<n; i++)
        x[sa[i]]=(y[sa[i-1]]==y[sa[i]] && y[sa[i-1]+k]==y[sa[i]+k])? p-1 : p++;
        if (p>=n) break;
        m=p;
    }
}
void print(int x)
{
    for (int i=x; i<=n; i++)
    if (s[i]>2)cout<<fdx(s[i]);
    else cout<<s[i];
    cout<<endl;
}
ll ans[maxn];
ll sum[5][maxn];
ll find(int l,int r)
{
    ll x0=sum[0][r]-sum[0][l-2];
    ll x1=sum[1][r]-sum[1][l-2];
    ll x2=sum[2][r]-sum[2][l-2];
    return (x0%mod*x1%mod*x2%mod)%mod;
}
void slove(vector<int> vv)
{
    vector<int>v[3];
    int p=0;
    for (int i=0; i<vv.size(); i++) v[p].push_back(vv[i]);
    int i=1;
    int last=0;
    ll tmp;
    while (i<=len)
    {
        int mi=len+1;
        if (v[p].size()==0) break;
        tmp=0;
        int l=v[p][0],r=v[p][0];
        if (height[v[p][0]]>i) v[p^1].push_back(v[p][0]);
        for (int j=1; j<v[p].size(); j++)
        {
            if (v[p][j]>v[p][j-1]+1 || height[v[p][j]]<i)
            {
                tmp+=find(l,r);
                tmp%=mod;
                l=v[p][j]; r=l;
            }
            else r=v[p][j];
            if (height[v[p][j]]>i) v[p^1].push_back(v[p][j]),mi=min(mi,height[v[p][j]]);
        }
        tmp+=find(l,r);
        tmp%=mod;
        ans[last+1]+=tmp;
        ans[i+1]-=tmp;
        ans[last+1]%=mod;
        ans[i+1]=((ans[i+1]%mod)+mod)%mod;
        if (tmp==0) break;
        v[p].clear();
        p=p^1;
        last=i;
        i=mi;
    }
}
int main()
{
//  freopen("in.txt","r",stdin);
    while(~scanf("%s",&ss))
    {
        l=strlen(ss);
        len=l;
        n=0;
        for (int i=0; i<l;i++)  belong[n]=0,s[n++]=idx(ss[i]);
        belong[n]=-1;s[n++]=1;
        scanf("%s",&ss); l=strlen(ss);
        len=min(len,l);
        for (int i=0; i<l; i++) belong[n]=1,s[n++]=idx(ss[i]);
        belong[n]=-1;s[n++]=2;
        scanf("%s",&ss); l=strlen(ss);
        len=min(len,l);
        for (int i=0; i<l; i++) belong[n]=2,s[n++]=idx(ss[i]);
        belong[n]=-1;s[n]=0;
        build_ss(33,n);
        getheight(n);

//  for (int i=0; i<=n; i++)
//      print(sa[i]);

        vector<int> v[3];
        memset(ans,0,sizeof ans);
        memset(sum,0,sizeof sum);
        int id;
        for (int i=0; i<=n; i++)
        {
            sum[0][i]=sum[0][i-1];
            sum[1][i]=sum[1][i-1];
            sum[2][i]=sum[2][i-1];
            if (belong[sa[i]]!=-1)
            {
                id=belong[sa[i]];
                sum[id][i]++;
            }
        }
        for (int i=0; i<=n; i++)
        {
            if (height[i]) v[0].push_back(i);
            else
            {
                slove(v[0]);
                v[0].clear();
            }
        }
        if (v[0].size()>0) slove(v[0]);
    /*  ll tmp=0;
        int p=0;
        for (int i=0; i<=n; i++)
            if (height[i])  v[p].push_back(i);
        int i=1;
        int last=0;
        while (i<=len)
        {
            int mi=len+1;
            if (v[p].size()==0) break;
            tmp=0;
            int l=v[p][0],r=v[p][0];
            if (height[v[p][0]]>i) v[p^1].push_back(v[p][0]);
            for (int j=1; j<v[p].size(); j++)
            {
                if (v[p][j]>v[p][j-1]+1 || height[v[p][j]]<i)
                {
                    tmp+=find(l,r);
                    tmp%=mod;
                    l=v[p][j]; r=l;
                }
                else r=v[p][j];
                if (height[v[p][j]]>i) v[p^1].push_back(v[p][j]),mi=min(mi,height[v[p][j]]);
            }
            tmp+=find(l,r);
            tmp%=mod;
            ans[last+1]+=tmp;
            ans[i+1]-=tmp;
            ans[last+1]%=mod;
            ans[i+1]=((ans[i+1]%mod)+mod)%mod;
            if (tmp==0) break;
            v[p].clear();
            p=p^1;
            last=i;
            i=mi;
        }*/
        for (int i=1; i<=len;i++)
            ans[i]=ans[i-1]+ans[i],ans[i]%=mod;
        for (int i=1; i<=len; i++)
            cout<<ans[i]<<" ";
        cout<<endl;

    }
    return 0;
}


/*=============================================================================
#  Author:Erich
#  FileName:
=============================================================================*/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#define lson id<<1,l,m
#define rson id<<1|1,m+1,r

using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
const ll INF=1ll<<60;
const double PI=acos(-1.0);
const int maxn=505000;
const int mod=1e9+7;
char ss[maxn];
int belong[maxn];
int s[maxn],rs[maxn];
int sa[maxn],t[maxn],t2[maxn],c[maxn];
int n,m,k,tt;
int rank[maxn],height[maxn];
int len,l;
inline int idx(char c)
{
    return c-'a'+3;
}
inline char fdx(int x)
{
    return char(x-3+'a');
}
void getheight(int n)
{
    int i,j,k=0;
    for (i=0; i<=n; i++) rank[sa[i]]=i;

    for (i=0; i<n; i++)
    {
        if (k) k--;
        int j=sa[rank[i]-1];
        while(s[i+k]==s[j+k]) k++;
        height[rank[i]]=k;
    }
}
void build_ss(int m,int n)
{
    n++;
    int i,*x=t,*y=t2;
    for (int i=0; i<m; i++) c[i]=0;
    for (int i=0; i<n; i++) c[x[i]=s[i]]++;
    for (int i=1; i<m; i++) c[i]+=c[i-1];
    for (int i=n-1; i>=0; i--)
      sa[--c[x[i]]]=i;
    for (int k=1; k<=n; k<<=1)
    {
        int p=0;
        for (i=n-k; i<n; i++) y[p++]=i;
        for (i=0; i<n; i++) if (sa[i]>=k) y[p++]=sa[i]-k;

        for (i=0; i<m; i++) c[i]=0;
        for (i=0; i<n; i++) c[x[y[i]]]++;
        for (i=1; i<m; i++) c[i]+=c[i-1];
        for (i=n-1; i>=0; i--) sa[--c[x[y[i]]]] = y[i];
        swap(x,y);
        p=1;
        x[sa[0]]=0;
        for (i=1; i<n; i++)
        x[sa[i]]=(y[sa[i-1]]==y[sa[i]] && y[sa[i-1]+k]==y[sa[i]+k])? p-1 : p++;
        if (p>=n) break;
        m=p;
    }
}
void print(int x)
{
    for (int i=x; i<=n; i++)
    if (s[i]>2)cout<<fdx(s[i]);
    else cout<<s[i];
    cout<<endl;
}
ll ans[maxn];
ll sum[5][maxn];
ll find(int l,int r)
{

    ll x0=sum[0][r]-sum[0][l-2];
    ll x1=sum[1][r]-sum[1][l-2];
    ll x2=sum[2][r]-sum[2][l-2];
    return (x0%mod*x1%mod*x2%mod)%mod;
}
int main()
{
//  freopen("in.txt","r",stdin);
    while(~scanf("%s",&ss))
    {
        l=strlen(ss);
        len=l;
        n=0;
        for (int i=0; i<l;i++)  belong[n]=0,s[n++]=idx(ss[i]);
        belong[n]=-1;s[n++]=1;
        scanf("%s",&ss); l=strlen(ss);
        len=min(len,l);
        for (int i=0; i<l; i++) belong[n]=1,s[n++]=idx(ss[i]);
        belong[n]=-1;s[n++]=2;
        scanf("%s",&ss); l=strlen(ss);
        len=min(len,l);
        for (int i=0; i<l; i++) belong[n]=2,s[n++]=idx(ss[i]);
        belong[n]=-1;s[n]=0;
        build_ss(33,n);
        getheight(n);

//  for (int i=0; i<=n; i++)
//      print(sa[i]);

        vector<int> v[3];
        memset(ans,0,sizeof ans);
        memset(sum,0,sizeof sum);
        int id;
        for (int i=0; i<=n; i++)
        {
            sum[0][i]=sum[0][i-1];
            sum[1][i]=sum[1][i-1];
            sum[2][i]=sum[2][i-1];
            if (belong[sa[i]]!=-1)
            {
                id=belong[sa[i]];
                sum[id][i]++;
            }
        }
        ll tmp=0;
        int p=0;
        for (int i=0; i<=n; i++)
            if (height[i])  v[p].push_back(i);

        for (int i=1; i<=len; i++)
        {
            if (v[p].size()==0) break;
            tmp=0;
            int l=v[p][0],r=v[p][0];
            if (height[v[p][0]]>i) v[p^1].push_back(v[p][0]);
            for (int j=1; j<v[p].size(); j++)
            {
                if (v[p][j]>v[p][j-1]+1 || height[v[p][j]]<i)
                {
                    tmp+=find(l,r);
                    tmp%=mod;
                    l=v[p][j]; r=l;
                }
                else r=v[p][j];
                if (height[v[p][j]]>i) v[p^1].push_back(v[p][j]);
            }
            tmp+=find(l,r);
            ans[i]=tmp;
            if (tmp==0) break;
            v[p].clear();
            p=p^1;
        }
        for (int i=1; i<=len; i++)
            cout<<ans[i]<<" ";
        cout<<endl;

    }
    return 0;
}


#include <bits/stdc++.h>

#define	st first
#define	nd second
#define	mp make_pair
#define	pb push_back
#define	lli long long int
#define	all( gg )	gg.begin(),gg.end()
#define	foreach( gg,itit )	for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define	FP( ii,aa,bb ) for( lli ii=aa;ii<=bb;ii++ )
#define	FM( ii,aa,bb ) for( lli ii=aa;ii>=bb;ii-- )
#define	debug(ccc)	cout << #ccc << " = " << ccc << endl;

#define	mod	1000000007LL
using namespace std;

int	n,N,g[400000];
char	s[400000],p[400000],q[400000];

lli	A[400000],B[400000],C[400000],ata[400000];
lli	res;

int	atabul( int nod ){
	return	ata[nod]==nod ? nod : ata[nod] = atabul( ata[nod] );
}

void	merge( int x,int y ){
	x = atabul(x);
	y = atabul(y);
	if( x==y )	assert(0);
	res -= A[x]*B[x]*C[x];
	res -= A[y]*B[y]*C[y];
	A[x]+=A[y];
	B[x]+=B[y];
	C[x]+=C[y];
	res += A[x]*B[x]*C[x];
	ata[y] = x;
}

pair< pair<int,int>,pair<int,int> >	SUF[800000];
int	sira[800000];

void	suffix_array(){
	FP( i,1,n )
		SUF[i] = mp( mp( s[i],0 ),mp( i,g[i] ) );
	sort( SUF+1,SUF+n+1 );
	for( int k=1;k<=n;k*=2 ){
		FP( i,1,n )	sira[SUF[i].nd.st] = sira[SUF[i-1].nd.st]+(SUF[i].st!=SUF[i-1].st);
		FP( i,1,n )	SUF[i] = mp( mp(sira[i],sira[i+k]),mp(i,g[i]) );
		sort( SUF+1,SUF+n+1 );
	}
	FP( i,1,n ){
		sira[ SUF[i].nd.st ] = i;
		if( SUF[i].nd.nd==1 )	A[i] = 1;
		if( SUF[i].nd.nd==2 )	B[i] = 1;
		if( SUF[i].nd.nd==3 )	C[i] = 1;
	}
}

int	l[400000];

vector<int>	v[400000];

int lcp_array(){
	int	h=0;
	FP( i,1,n ){
		if( sira[i]==n )	continue;
		while( s[i+h]==s[ SUF[ sira[i]+1 ].nd.st+h ] )	h++;
		v[h].pb( sira[i] );
		l[sira[i]] = h;
		if( h )	h--;
	}
	//FP( i,1,n )	cout << s+SUF[i].nd.st << "   " << l[i] <<  "    " << SUF[i].nd.nd << endl;
}

int main(){
	int	a,b,c;
	scanf("%s",s+1);
	scanf("%s",p+1);
	scanf("%s",q+1);
	a = strlen( s+1 );
	b = strlen( p+1 );
	c = strlen( q+1 );
	N = min( a , min( b , c ) );
	n = a + b + c + 2;
	FP( i,1,n )	ata[i] = i;
	FP( i,1,a )
		g[i] = 1;
	FP( i,a+2,a+b+1 )
		g[i] = 2;
	FP( i,a+b+3,a+b+c+2 )
		g[i] = 3;
	strcat( s+1,"$" );
	strcat( s+1,p+1 );
	strcat( s+1,"#" );
	strcat( s+1,q+1 );
	suffix_array();
	lcp_array();
	vector<lli>	ret;
	FM( i,max(a,max(b,c)),1 ){
		foreach( v[i],it ){
			merge( *it,*it+1 );
		}
		if( i<=N )
			ret.pb( res%mod );
	}
	reverse( all(ret) );
	foreach( ret,it )
		cout << *it << " ";
	cout << endl;
}


#include <bits/stdc++.h>

#define	st first
#define	nd second
#define	mp make_pair
#define	pb push_back
#define	lli long long int
#define	all( gg )	gg.begin(),gg.end()
#define	foreach( gg,itit )	for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define	FP( ii,aa,bb ) for( lli ii=aa;ii<=bb;ii++ )
#define	FM( ii,aa,bb ) for( lli ii=aa;ii>=bb;ii-- )
#define	debug(ccc)	cout << #ccc << " = " << ccc << endl;

#define	mod	1000000007LL
using namespace std;

int	n,N,g[400000];
char	s[400000],p[400000],q[400000];

lli	A[400000],B[400000],C[400000],ata[400000];
lli	res;

int	atabul( int nod ){
	return	ata[nod]==nod ? nod : ata[nod] = atabul( ata[nod] );
}

void	merge( int x,int y ){
	x = atabul(x);
	y = atabul(y);
	if( x==y )	return;
	res -= A[x]*B[x]*C[x];
	res -= A[y]*B[y]*C[y];
	A[x]+=A[y];
	B[x]+=B[y];
	C[x]+=C[y];
	res += A[x]*B[x]*C[x];
	ata[y] = x;
}

pair< pair<int,int>,pair<int,int> >	SUF[800000];
int	sira[800000];

void	suffix_array(){
	FP( i,1,n )
		SUF[i] = mp( mp( s[i],0 ),mp( i,g[i] ) );
	sort( SUF+1,SUF+n+1 );
	for( int k=1;k<=n;k*=2 ){
		FP( i,1,n )	sira[SUF[i].nd.st] = sira[SUF[i-1].nd.st]+(SUF[i].st!=SUF[i-1].st);
		FP( i,1,n )	SUF[i] = mp( mp(sira[i],sira[i+k]),mp(i,g[i]) );
		sort( SUF+1,SUF+n+1 );
	}
	FP( i,1,n ){
		sira[ SUF[i].nd.st ] = i;
		if( SUF[i].nd.nd==1 )	A[i] = 1;
		if( SUF[i].nd.nd==2 )	B[i] = 1;
		if( SUF[i].nd.nd==3 )	C[i] = 1;
	}
}

vector<int>	v[400000];

int lcp_array(){
	int	h=0;
	FP( i,1,n ){
		if( sira[i]==n )	continue;
		while( s[i+h]==s[ SUF[ sira[i]+1 ].nd.st+h ] )	h++;
		v[h].pb( sira[i] );
		if( h )	h--;
	}
}

int main(){
	int	a,b,c;
	scanf("%s",s+1);
	scanf("%s",p+1);
	scanf("%s",q+1);
	a = strlen( s+1 );
	b = strlen( p+1 );
	c = strlen( q+1 );
	N = min( a , min( b , c ) );
	n = a + b + c + 2;
	FP( i,1,n )	ata[i] = i;
	FP( i,1,a )
		g[i] = 1;
	FP( i,a+2,a+b+1 )
		g[i] = 2;
	FP( i,a+b+3,a+b+c+2 )
		g[i] = 3;
	strcat( s+1,"$" );
	strcat( s+1,p+1 );
	strcat( s+1,"#" );
	strcat( s+1,q+1 );
	suffix_array();
	lcp_array();
	vector<lli>	ret;
	FM( i,N,1 ){
		foreach( v[i],it )
			merge( *it,*it+1 );
		ret.pb( res%mod );
	}
	reverse( all(ret) );
	foreach( ret,it )
		cout << *it << " ";
	cout << endl;
}


#include <algorithm>
#include <iostream>
#include <iterator>
#include <limits>
#include <numeric>
#include <string>
#include <utility>
#include <vector>

using namespace std;

struct SuffixArrayBase {
    vector<int> sa, rank, height;

    template<typename T>
    void init(int n, const T a[]) {
        height.resize(n);
        for (int i = 0, z = 0; i < n; ++i) {
            if (rank[i] == 0) {
                height[0] = z = 0;
            } else {
                int x = i, y = sa[rank[i] - 1];
                z = max(0, z - 1);
                while (x + z < n && y + z < n && a[x + z] == a[y + z]) {
                    ++z;
                }
                height[rank[i]] = z;
            }
        }
    }
};

struct SuffixArrayYoung: SuffixArrayBase {
    template<typename T>
    void init(int n, const T a[]) {
        sa.resize(n);
        rank.resize(n);

        vector<pair<T, int> > assoc(n);
        for (int i = 0; i < n; ++i) {
            assoc[i] = make_pair(a[i], i);
        }
        sort(assoc.begin(), assoc.end());
        for (int i = 0; i < n; ++i) {
            sa[i] = assoc[i].second;
            if (i == 0 || assoc[i].first != assoc[i - 1].first) {
                rank[sa[i]] = i;
            } else {
                rank[sa[i]] = rank[sa[i - 1]];
            }
        }

        vector<int> tmp(n), cnt(n);
        vector<pair<int, int> > suffix(n);
        for (int m = 1; m < n; m <<= 1) {
            // snd
            for (int i = 0; i < m; ++i) {
                tmp[i] = n - m + i;
            }
            for (int i = 0, j = m; i < n; ++i) {
                if (sa[i] >= m) {
                    tmp[j++] = sa[i] - m;
                }
            }
            // fst
            fill(cnt.begin(), cnt.end(), 0);
            for (int i = 0; i < n; ++i) {
                ++cnt[rank[i]];
            }
            partial_sum(cnt.begin(), cnt.end(), cnt.begin());
            for (int i = n - 1; i >= 0; --i) {
                sa[--cnt[rank[tmp[i]]]] = tmp[i];
            }
            //
            for (int i = 0; i < n; ++i) {
                suffix[i] = make_pair(rank[i], i + m < n ? rank[i + m] : numeric_limits<int>::min());
            }
            for (int i = 0; i < n; ++i) {
                if (i == 0 || suffix[sa[i]] != suffix[sa[i - 1]]) {
                    rank[sa[i]] = i;
                } else {
                    rank[sa[i]] = rank[sa[i - 1]];
                }
            }
        }

        SuffixArrayBase::init(n, a);
    }
};

SuffixArrayYoung SA;

const int MAX_L = (int) (1e6);
const int MOD = (int) (1e9 + 7);

int a[MAX_L], belongs[MAX_L];
pair<int, int> e[MAX_L];
int p[MAX_L], cnt[MAX_L][3];

int find(int x) {
    return x == p[x] ? x : (p[x] = find(p[x]));
}

int add(int a, int b) {
    return (a + b) % MOD;
}

int mul(int a, int b) {
    return (a * 1LL * b) % MOD;
}

int main() {
    ios_base::sync_with_stdio(false);

    string s[3];
    int st[3], ed[3];
    int l = MAX_L, n = 0;
    for (int i = 0; i < 3; ++i) {
        cin >> s[i];
        l = min(l, (int) s[i].size());
        st[i] = n;
        for (int j = 0; j < s[i].size(); ++j) {
            a[n++] = s[i][j] - 'a';
        }
        ed[i] = n - 1;
        if (i != 2) {
            a[n++] = 26;
        }
    }

    SA.init(n, a);

    for (int i = 0; i < n - 2; ++i) {
        for (int j = 0; j < 3; ++j) {
            if (st[j] <= SA.sa[i] && SA.sa[i] <= ed[j]) {
                belongs[i] = j;
                break;
            }
        }
    }

    int m = 0;
    for (int i = 1; i < n - 2; ++i) {
        int lcp = SA.height[i];
        lcp = min(lcp, ed[belongs[i - 1]] - SA.sa[i - 1] + 1);
        lcp = min(lcp, ed[belongs[i]] - SA.sa[i] + 1);
        e[m++] = make_pair(lcp, i);
    }
    sort(e, e + m);

    for (int i = 0; i < n - 2; ++i) {
        p[i] = i;
        fill(cnt[i], cnt[i] + 3, 0);
        cnt[i][belongs[i]] = 1;
    }

    vector<int> result(l + 1, 0);
    int current = 0;
    for (int i = l, j = m - 1; i >= 1; --i) {
        for (; j >= 0 && e[j].first >= i; --j) {
            int x = find(e[j].second - 1), y = find(e[j].second);
            if (x == y) {
                continue;
            }
            current = add(current, MOD - mul(cnt[x][0], mul(cnt[x][1], cnt[x][2])));
            current = add(current, MOD - mul(cnt[y][0], mul(cnt[y][1], cnt[y][2])));
            p[y] = x;
            for (int k = 0; k < 3; ++k) {
                cnt[x][k] += cnt[y][k];
            }
            current = add(current, mul(cnt[x][0], mul(cnt[x][1], cnt[x][2])));
        }
        result[i] = current;
    }

    for (int i = 1; i <= l; ++i) {
        cout << result[i] << (i == l ? "\n" : " ");
    }

    return 0;
}


#include <algorithm>
#include <iostream>
#include <iterator>
#include <limits>
#include <numeric>
#include <string>
#include <utility>
#include <vector>

using namespace std;

struct SuffixArray {
    vector<int> sa, rank, height;

    template<typename T>
    void init(int n, const T a[]) {
        sa.resize(n);
        rank.resize(n);
        height.resize(n);

        vector<pair<T, int> > assoc(n);
        for (int i = 0; i < n; ++i) {
            assoc[i] = make_pair(a[i], i);
        }
        sort(assoc.begin(), assoc.end());
        for (int i = 0; i < n; ++i) {
            sa[i] = assoc[i].second;
            if (i == 0 || assoc[i].first != assoc[i - 1].first) {
                rank[sa[i]] = i;
            } else {
                rank[sa[i]] = rank[sa[i - 1]];
            }
        }

        vector<int> tmp(n), cnt(n);
        vector<pair<int, int> > suffix(n);
        for (int m = 1; m < n; m <<= 1) {
            // snd
            for (int i = 0; i < m; ++i) {
                tmp[i] = n - m + i;
            }
            for (int i = 0, j = m; i < n; ++i) {
                if (sa[i] >= m) {
                    tmp[j++] = sa[i] - m;
                }
            }
            // fst
            fill(cnt.begin(), cnt.end(), 0);
            for (int i = 0; i < n; ++i) {
                ++cnt[rank[i]];
            }
            partial_sum(cnt.begin(), cnt.end(), cnt.begin());
            for (int i = n - 1; i >= 0; --i) {
                sa[--cnt[rank[tmp[i]]]] = tmp[i];
            }
            //
            for (int i = 0; i < n; ++i) {
                suffix[i] = make_pair(rank[i],
                        i + m < n ? rank[i + m] : numeric_limits<int>::min());
            }
            for (int i = 0; i < n; ++i) {
                if (i == 0 || suffix[sa[i]] != suffix[sa[i - 1]]) {
                    rank[sa[i]] = i;
                } else {
                    rank[sa[i]] = rank[sa[i - 1]];
                }
            }
        }

        for (int i = 0, z = 0; i < n; ++i) {
            if (rank[i] == 0) {
                height[0] = z = 0;
            } else {
                int x = i, y = sa[rank[i] - 1];
                z = max(0, z - 1);
                while (x + z < n && y + z < n && a[x + z] == a[y + z]) {
                    ++z;
                }
                height[rank[i]] = z;
            }
        }
    }
};

SuffixArray SA;

const int MAX_L = (int) (1e6);
const int MOD = (int) (1e9 + 7);

int a[MAX_L], belongs[MAX_L];
pair<int, int> e[MAX_L];
int p[MAX_L], cnt[MAX_L][3];

int find(int x) {
    return x == p[x] ? x : (p[x] = find(p[x]));
}

int add(int a, int b) {
    return (a + b) % MOD;
}

int mul(int a, int b) {
    return (a * 1LL * b) % MOD;
}

int main() {
    ios_base::sync_with_stdio(false);

    string s[3];
    int st[3], ed[3], l = MAX_L, n = 0;
    for (int i = 0; i < 3; ++i) {
        cin >> s[i];
        l = min(l, (int) s[i].size());
        st[i] = n;
        for (int j = 0; j < s[i].size(); ++j) {
            a[n++] = s[i][j] - 'a';
        }
        ed[i] = n - 1;
        if (i != 2) {
            a[n++] = 26;
        }
    }

    SA.init(n, a);

    for (int i = 0; i < n - 2; ++i) {
        for (int j = 0; j < 3; ++j) {
            if (st[j] <= SA.sa[i] && SA.sa[i] <= ed[j]) {
                belongs[i] = j;
                break;
            }
        }
    }

    int m = 0;
    for (int i = 1; i < n - 2; ++i) {
        int lcp = SA.height[i];
        lcp = min(lcp, ed[belongs[i - 1]] - SA.sa[i - 1] + 1);
        lcp = min(lcp, ed[belongs[i]] - SA.sa[i] + 1);
        if (lcp > 0) {
            e[m++] = make_pair(lcp, i);
        }
    }
    sort(e, e + m);

    for (int i = 0; i < n - 2; ++i) {
        p[i] = i;
        fill(cnt[i], cnt[i] + 3, 0);
        cnt[i][belongs[i]] = 1;
    }

    vector<int> result(l + 1, 0);
    int current = 0;
    for (int i = l, j = m - 1; i >= 1; --i) {
        for (; j >= 0 && e[j].first >= i; --j) {
            int x = find(e[j].second - 1), y = find(e[j].second);
            if (x == y) {
                continue;
            }
            current = add(current,
                    MOD - mul(cnt[x][0], mul(cnt[x][1], cnt[x][2])));
            current = add(current,
                    MOD - mul(cnt[y][0], mul(cnt[y][1], cnt[y][2])));
            p[y] = x;
            for (int k = 0; k < 3; ++k) {
                cnt[x][k] += cnt[y][k];
            }
            current = add(current, mul(cnt[x][0], mul(cnt[x][1], cnt[x][2])));
        }
        result[i] = current;
    }

    for (int i = 1; i <= l; ++i) {
        cout << result[i] << (i == l ? "\n" : " ");
    }

    return 0;
}


#include <algorithm>
#include <iostream>
#include <iterator>
#include <limits>
#include <numeric>
#include <string>
#include <utility>
#include <vector>

using namespace std;

struct SuffixArrayBase {
	vector<int> sa, rank, height;

	template<typename T>
	void init(int n, const T a[]) {
		height.resize(n);
		for (int i = 0, z = 0; i < n; ++i) {
			if (rank[i] == 0) {
				height[0] = z = 0;
			} else {
				int x = i, y = sa[rank[i] - 1];
				z = max(0, z - 1);
				while (x + z < n && y + z < n && a[x + z] == a[y + z]) {
					++z;
				}
				height[rank[i]] = z;
			}
		}
	}
};

struct SuffixArrayYoung: SuffixArrayBase {
	template<typename T>
	void init(int n, const T a[]) {
		sa.resize(n);
		rank.resize(n);

		vector<pair<T, int> > assoc(n);
		for (int i = 0; i < n; ++i) {
			assoc[i] = make_pair(a[i], i);
		}
		sort(assoc.begin(), assoc.end());
		for (int i = 0; i < n; ++i) {
			sa[i] = assoc[i].second;
			if (i == 0 || assoc[i].first != assoc[i - 1].first) {
				rank[sa[i]] = i;
			} else {
				rank[sa[i]] = rank[sa[i - 1]];
			}
		}

		vector<int> tmp(n), cnt(n);
		vector<pair<int, int> > suffix(n);
		for (int m = 1; m < n; m <<= 1) {
			// snd
			for (int i = 0; i < m; ++i) {
				tmp[i] = n - m + i;
			}
			for (int i = 0, j = m; i < n; ++i) {
				if (sa[i] >= m) {
					tmp[j++] = sa[i] - m;
				}
			}
			// fst
			fill(cnt.begin(), cnt.end(), 0);
			for (int i = 0; i < n; ++i) {
				++cnt[rank[i]];
			}
			partial_sum(cnt.begin(), cnt.end(), cnt.begin());
			for (int i = n - 1; i >= 0; --i) {
				sa[--cnt[rank[tmp[i]]]] = tmp[i];
			}
			//
			for (int i = 0; i < n; ++i) {
				suffix[i] = make_pair(rank[i],
						i + m < n ? rank[i + m] : numeric_limits<int>::min());
			}
			for (int i = 0; i < n; ++i) {
				if (i == 0 || suffix[sa[i]] != suffix[sa[i - 1]]) {
					rank[sa[i]] = i;
				} else {
					rank[sa[i]] = rank[sa[i - 1]];
				}
			}
		}

		SuffixArrayBase::init(n, a);
	}
};

SuffixArrayYoung SA;

const int MAX_L = (int) (1e6);
const int MOD = (int) (1e9 + 7);

int a[MAX_L], belongs[MAX_L];

struct Node {
	int x, lcp;
	Node() {
	}
	Node(int _x, int _lcp) :
			x(_x), lcp(_lcp) {
	}
	bool operator<(const Node & o) const {
		return lcp > o.lcp;
	}
};

Node e[MAX_L];

int p[MAX_L], cnt[MAX_L][3];

int find(int x) {
	return x == p[x] ? x : (p[x] = find(p[x]));
}

int add(int a, int b) {
	return (a + b) % MOD;
}

int mul(int a, int b) {
	return (a * 1LL * b) % MOD;
}

int main() {
	ios_base::sync_with_stdio(false);

	string s[3];
	int st[3], ed[3];
	int l = MAX_L, n = 0;
	for (int i = 0; i < 3; ++i) {
		cin >> s[i];
		l = min(l, (int) s[i].size());
		st[i] = n;
		for (int j = 0; j < s[i].size(); ++j) {
			a[n++] = s[i][j] - 'a';
		}
		ed[i] = n - 1;
		if (i != 2) {
			a[n++] = 26;
		}
	}

	SA.init(n, a);

//	for(int i = 0; i < n; ++i) {
//		cout << i << ": ";
//		for(int j = SA.sa[i]; j < n; ++j) {
//			cout << a[j] << " ";
//		}
//		cout << endl;
//	}

	for (int i = 0; i < n - 2; ++i) {
		for (int j = 0; j < 3; ++j) {
			if (st[j] <= SA.sa[i] && SA.sa[i] <= ed[j]) {
				belongs[i] = j;
				break;
			}
		}
	}
	int m = 0;
	for (int i = 1; i < n - 2; ++i) {
		int lcp = SA.height[i];
		lcp = min(lcp, ed[belongs[i - 1]] - SA.sa[i - 1] + 1);
		lcp = min(lcp, ed[belongs[i]] - SA.sa[i] + 1);
		e[m++] = Node(i, lcp);
	}
	sort(e, e + m);

	for (int i = 0; i < n - 2; ++i) {
		p[i] = i;
		fill(cnt[i], cnt[i] + 3, 0);
		cnt[i][belongs[i]] = 1;
	}

	vector<int> result(l + 1, 0);
	int current = 0;
	for (int i = l, j = 0; i >= 1; --i) {
		for (; j < m && e[j].lcp >= i; ++j) {
			int x = find(e[j].x - 1), y = find(e[j].x);
			if (x != y) {
				current = add(current, MOD - mul(cnt[x][0], mul(cnt[x][1], cnt[x][2])));
				current = add(current, MOD - mul(cnt[y][0], mul(cnt[y][1], cnt[y][2])));
				p[y] = x;
				for (int k = 0; k < 3; ++k) {
					cnt[x][k] += cnt[y][k];
				}
				current = add(current, mul(cnt[x][0], mul(cnt[x][1], cnt[x][2])));
			}
		}
		result[i] = current;
	}

	for (int i = 1; i <= l; ++i) {
		cout << result[i] << (i == l ? "\n" : " ");
	}

	return 0;
}


#include <algorithm>
#include <iostream>
#include <iterator>
#include <limits>
#include <numeric>
#include <string>
#include <utility>
#include <vector>

using namespace std;

struct SuffixArray {
    vector<int> sa, rank, height;

    template<typename T>
    void init(int n, const T a[]) {
        sa.resize(n);
        rank.resize(n);
        height.resize(n);

        vector<pair<T, int> > assoc(n);
        for (int i = 0; i < n; ++i) {
            assoc[i] = make_pair(a[i], i);
        }
        sort(assoc.begin(), assoc.end());
        for (int i = 0; i < n; ++i) {
            sa[i] = assoc[i].second;
            if (i == 0 || assoc[i].first != assoc[i - 1].first) {
                rank[sa[i]] = i;
            } else {
                rank[sa[i]] = rank[sa[i - 1]];
            }
        }

        vector<int> tmp(n), cnt(n);
        vector<pair<int, int> > suffix(n);
        for (int m = 1; m < n; m <<= 1) {
            // snd
            for (int i = 0; i < m; ++i) {
                tmp[i] = n - m + i;
            }
            for (int i = 0, j = m; i < n; ++i) {
                if (sa[i] >= m) {
                    tmp[j++] = sa[i] - m;
                }
            }
            // fst
            fill(cnt.begin(), cnt.end(), 0);
            for (int i = 0; i < n; ++i) {
                ++cnt[rank[i]];
            }
            partial_sum(cnt.begin(), cnt.end(), cnt.begin());
            for (int i = n - 1; i >= 0; --i) {
                sa[--cnt[rank[tmp[i]]]] = tmp[i];
            }
            //
            for (int i = 0; i < n; ++i) {
                suffix[i] = make_pair(rank[i], i + m < n ? rank[i + m] : numeric_limits<int>::min());
            }
            for (int i = 0; i < n; ++i) {
                if (i == 0 || suffix[sa[i]] != suffix[sa[i - 1]]) {
                    rank[sa[i]] = i;
                } else {
                    rank[sa[i]] = rank[sa[i - 1]];
                }
            }
        }

        for (int i = 0, z = 0; i < n; ++i) {
            if (rank[i] == 0) {
                height[0] = z = 0;
            } else {
                int x = i, y = sa[rank[i] - 1];
                z = max(0, z - 1);
                while (x + z < n && y + z < n && a[x + z] == a[y + z]) {
                    ++z;
                }
                height[rank[i]] = z;
            }
        }
    }
};

SuffixArray SA;

const int MAX_L = (int) (1e6);
const int MOD = (int) (1e9 + 7);

int a[MAX_L], belongs[MAX_L];
pair<int, int> e[MAX_L];
int p[MAX_L], cnt[MAX_L][3];

int find(int x) {
    return x == p[x] ? x : (p[x] = find(p[x]));
}

int add(int a, int b) {
    return (a + b) % MOD;
}

int mul(int a, int b) {
    return (a * 1LL * b) % MOD;
}

int main() {
    ios_base::sync_with_stdio(false);

    string s[3];
    int st[3], ed[3], l = MAX_L, n = 0;
    for (int i = 0; i < 3; ++i) {
        cin >> s[i];
        l = min(l, (int) s[i].size());
        st[i] = n;
        for (int j = 0; j < s[i].size(); ++j) {
            a[n++] = s[i][j] - 'a';
        }
        ed[i] = n - 1;
        if (i != 2) {
            a[n++] = 26;
        }
    }

    SA.init(n, a);

    for (int i = 0; i < n - 2; ++i) {
        for (int j = 0; j < 3; ++j) {
            if (st[j] <= SA.sa[i] && SA.sa[i] <= ed[j]) {
                belongs[i] = j;
                break;
            }
        }
    }

    int m = 0;
    for (int i = 1; i < n - 2; ++i) {
        int lcp = SA.height[i];
        lcp = min(lcp, ed[belongs[i - 1]] - SA.sa[i - 1] + 1);
        lcp = min(lcp, ed[belongs[i]] - SA.sa[i] + 1);
        e[m++] = make_pair(lcp, i);
    }
    sort(e, e + m);

    for (int i = 0; i < n - 2; ++i) {
        p[i] = i;
        fill(cnt[i], cnt[i] + 3, 0);
        cnt[i][belongs[i]] = 1;
    }

    vector<int> result(l + 1, 0);
    int current = 0;
    for (int i = l, j = m - 1; i >= 1; --i) {
        for (; j >= 0 && e[j].first >= i; --j) {
            int x = find(e[j].second - 1), y = find(e[j].second);
            if (x == y) {
                continue;
            }
            current = add(current,
                    MOD - mul(cnt[x][0], mul(cnt[x][1], cnt[x][2])));
            current = add(current,
                    MOD - mul(cnt[y][0], mul(cnt[y][1], cnt[y][2])));
            p[y] = x;
            for (int k = 0; k < 3; ++k) {
                cnt[x][k] += cnt[y][k];
            }
            current = add(current, mul(cnt[x][0], mul(cnt[x][1], cnt[x][2])));
        }
        result[i] = current;
    }

    for (int i = 1; i <= l; ++i) {
        cout << result[i] << (i == l ? "\n" : " ");
    }

    return 0;
}


#include <algorithm>
#include <iostream>
#include <iterator>
#include <limits>
#include <numeric>
#include <string>
#include <utility>
#include <vector>

using namespace std;

struct SuffixArrayBase {
	vector<int> sa, rank, height;

	template<typename T>
	void init(int n, const T a[]) {
		height.resize(n);
		for (int i = 0, z = 0; i < n; ++i) {
			if (rank[i] == 0) {
				height[0] = z = 0;
			} else {
				int x = i, y = sa[rank[i] - 1];
				z = max(0, z - 1);
				while (x + z < n && y + z < n && a[x + z] == a[y + z]) {
					++z;
				}
				height[rank[i]] = z;
			}
		}
	}
};

struct SuffixArrayYoung: SuffixArrayBase {
	template<typename T>
	void init(int n, const T a[]) {
		sa.resize(n);
		rank.resize(n);

		vector<pair<T, int> > assoc(n);
		for (int i = 0; i < n; ++i) {
			assoc[i] = make_pair(a[i], i);
		}
		sort(assoc.begin(), assoc.end());
		for (int i = 0; i < n; ++i) {
			sa[i] = assoc[i].second;
			if (i == 0 || assoc[i].first != assoc[i - 1].first) {
				rank[sa[i]] = i;
			} else {
				rank[sa[i]] = rank[sa[i - 1]];
			}
		}

		vector<int> tmp(n), cnt(n);
		vector<pair<int, int> > suffix(n);
		for (int m = 1; m < n; m <<= 1) {
			// snd
			for (int i = 0; i < m; ++i) {
				tmp[i] = n - m + i;
			}
			for (int i = 0, j = m; i < n; ++i) {
				if (sa[i] >= m) {
					tmp[j++] = sa[i] - m;
				}
			}
			// fst
			fill(cnt.begin(), cnt.end(), 0);
			for (int i = 0; i < n; ++i) {
				++cnt[rank[i]];
			}
			partial_sum(cnt.begin(), cnt.end(), cnt.begin());
			for (int i = n - 1; i >= 0; --i) {
				sa[--cnt[rank[tmp[i]]]] = tmp[i];
			}
			//
			for (int i = 0; i < n; ++i) {
				suffix[i] = make_pair(rank[i],
						i + m < n ? rank[i + m] : numeric_limits<int>::min());
			}
			for (int i = 0; i < n; ++i) {
				if (i == 0 || suffix[sa[i]] != suffix[sa[i - 1]]) {
					rank[sa[i]] = i;
				} else {
					rank[sa[i]] = rank[sa[i - 1]];
				}
			}
		}

		SuffixArrayBase::init(n, a);
	}
};

SuffixArrayYoung SA;

const int MAX_L = (int) (1e6);
const int MOD = (int) (1e9 + 7);

int a[MAX_L], belongs[MAX_L];

struct Node {
	int x, lcp;
	Node() {
	}
	Node(int _x, int _lcp) :
			x(_x), lcp(_lcp) {
	}
	bool operator<(const Node & o) const {
		return lcp > o.lcp;
	}
};

Node e[MAX_L];

int p[MAX_L], cnt[MAX_L][3];

int find(int x) {
	return x == p[x] ? x : (p[x] = find(p[x]));
}

int add(int a, int b) {
	return (a + b) % MOD;
}

int mul(int a, int b) {
	return (a * 1LL * b) % MOD;
}

int main() {
	ios_base::sync_with_stdio(false);

	string s[3];
	int st[3], ed[3];
	int l = MAX_L, n = 0;
	for (int i = 0; i < 3; ++i) {
		cin >> s[i];
		l = min(l, (int) s[i].size());
		st[i] = n;
		for (int j = 0; j < s[i].size(); ++j) {
			a[n++] = s[i][j] - 'a';
		}
		ed[i] = n - 1;
		if (i != 2) {
			a[n++] = 26;
		}
	}

	SA.init(n, a);

	for (int i = 0; i < n - 2; ++i) {
		for (int j = 0; j < 3; ++j) {
			if (st[j] <= SA.sa[i] && SA.sa[i] <= ed[j]) {
				belongs[i] = j;
				break;
			}
		}
	}
	int m = 0;
	for (int i = 1; i < n - 2; ++i) {
		int lcp = SA.height[i];
		lcp = min(lcp, ed[belongs[i - 1]] - SA.sa[i - 1] + 1);
		lcp = min(lcp, ed[belongs[i]] - SA.sa[i] + 1);
		e[m++] = Node(i, lcp);
	}
	sort(e, e + m);

	for (int i = 0; i < n - 2; ++i) {
		p[i] = i;
		fill(cnt[i], cnt[i] + 3, 0);
		cnt[i][belongs[i]] = 1;
	}

	vector<int> result(l + 1, 0);
	int current = 0;
	for (int i = l, j = 0; i >= 1; --i) {
		for (; j < m && e[j].lcp == i; ++j) {
			int x = find(e[j].x - 1), y = find(e[j].x);
			if (x != y) {
				current = add(current, MOD - mul(cnt[x][0], mul(cnt[x][1], cnt[x][2])));
				current = add(current, MOD - mul(cnt[y][0], mul(cnt[y][1], cnt[y][2])));
				p[y] = x;
				for (int k = 0; k < 3; ++k) {
					cnt[x][k] += cnt[y][k];
				}
				current = add(current, mul(cnt[x][0], mul(cnt[x][1], cnt[x][2])));
			}
		}
		result[i] = current;
	}

	for (int i = 1; i <= l; ++i) {
		cout << result[i] << (i == l ? "\n" : " ");
	}

	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <queue>
#include <stack>
#include <algorithm>
#include <sstream>
#include <numeric>
using namespace std;

#define f first
#define s second
#define mp make_pair
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define forit(it,S) for(__typeof(S.begin()) it = S.begin(); it != S.end(); ++it)
#ifdef WIN32
#define I64d "%I64d"
#else
#define I64d "%lld"
#endif

typedef pair <int, int> pi;
typedef pair <int, pi> pii;
typedef vector <int> vi;
typedef long long ll;

const int mod = int(1e9 + 7);
int lp[11], pp, vn, last;
char s[333333];
int to[30][666666], suff[666666], pos[666666];
int len[666666], add[666666];
vector <int> e[666666];

void append(int c) {
    int v = vn++;
    len[v] = len[last] + 1;
    pos[v] = pp++;

    int p = last;
    while (p != -1 && to[p][c] == -1) {
        to[p][c] = v;
        p = suff[p];
    }

    if (p == -1) {
        suff[v] = 0;
    } else {
        int q = to[p][c];
        if (len[p] == len[q] + 1) {
            suff[v] = q;
        } else {
            int clone = vn++;
            len[clone] = len[p] + 1;
            pos[clone] = -1;
            memcpy(to[clone], to[q], sizeof(int) * 30);
            suff[clone] = suff[q];
            suff[q] = clone;
            suff[v] = clone;

            while (p != -1 && to[p][c] == q) {
                to[p][c] = clone;
                p = suff[p];
            }
        }
    }
    last = v;
}

pii rec(int u) {
    pii sum = mp(0, mp(0, 0));
    forit (it, e[u]) {
        int v = *it;
        pii pa = rec(v);
        sum.f += pa.f;
        sum.s.f += pa.s.f;
        sum.s.s += pa.s.s;
    }

    if (u != 0) {
        int p = pos[u];
        if (p != -1) {
            if (p < lp[0] - 1) ++sum.f;
            else if (p > lp[0] - 1 && p < lp[1] - 1) ++sum.s.f;
            else if (p > lp[1] - 1 && p < lp[2] - 1) ++sum.s.s;
        }
        int cur = (1LL * sum.f * sum.s.f) % mod;
        cur = (1LL * cur * sum.s.s) % mod;

        int l = len[suff[u]] + 1, r = len[u];

        add[l] += cur;
        if (add[l] >= mod) add[l] -= mod;

        add[r + 1] -= cur;
        if (add[r + 1] < 0) add[r + 1] += mod;
    }
    return sum;
}

int main() {
    memset(to, -1, sizeof(to));
    memset(suff, -1, sizeof(suff));
    last = vn++;

    int mlen = -1;

    for (int i = 0; i < 3; ++i) {
        scanf("%s", s);
        int len = strlen(s);
        if (mlen == -1 || mlen > len) {
            mlen = len;
        }

        for (int j = 0; j < len; ++j) {
            append(s[j] - 'a');
        }
        append(27 + i);

        lp[i] = pp;
    }

    for (int i = 1; i < vn; ++i) {
        e[suff[i]].pb(i);
    }

    rec(0);

    int sum = 0;
    for (int i = 1; i <= mlen; ++i) {
        if (i > 1) putchar(' ');
        sum += add[i];
        if (sum >= mod) sum -= mod;
        printf("%d", sum);
    }
    puts("");
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <queue>
#include <stack>
#include <algorithm>
#include <sstream>
#include <numeric>
using namespace std;

#define f first
#define s second
#define mp make_pair
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define forit(it,S) for(__typeof(S.begin()) it = S.begin(); it != S.end(); ++it)
#ifdef WIN32
#define I64d "%I64d"
#else
#define I64d "%lld"
#endif

typedef pair <int, int> pi;
typedef pair <int, pi> pii;
typedef vector <int> vi;
typedef long long ll;

const int mod = int(1e9 + 7);
int lp[11], pp, vn, last;
char s[666666];
int to[666666][30], suff[666666], pos[666666];
int len[666666], add[666666];
vector <int> e[666666];

void append(int c) {
    int v = vn++;
    len[v] = len[last] + 1;
    pos[v] = pp++;

    int p = last;
    while (p != -1 && to[p][c] == -1) {
        to[p][c] = v;
        p = suff[p];
    }

    if (p == -1) {
        suff[v] = 0;
    } else {
        int q = to[p][c];
        if (len[p] == len[q] + 1) {
            suff[v] = q;
        } else {
            int clone = vn++;
            len[clone] = len[p] + 1;
            pos[clone] = -1;
            memcpy(to[clone], to[q], sizeof(int) * 30);
            suff[clone] = suff[q];
            suff[q] = clone;
            suff[v] = clone;

            while (p != -1 && to[p][c] == q) {
                to[p][c] = clone;
                p = suff[p];
            }
        }
    }
    last = v;
}

pii rec(int u) {
    pii sum = mp(0, mp(0, 0));
    forit (it, e[u]) {
        int v = *it;
        pii pa = rec(v);
        sum.f += pa.f;
        sum.s.f += pa.s.f;
        sum.s.s += pa.s.s;
    }

    if (u != 0) {
        int p = pos[u];
        if (p != -1) {
            if (p < lp[0] - 1) ++sum.f;
            else if (p > lp[0] - 1 && p < lp[1] - 1) ++sum.s.f;
            else if (p > lp[1] - 1 && p < lp[2] - 1) ++sum.s.s;
        }
        int cur = (1LL * sum.f * sum.s.f) % mod;
        cur = (1LL * cur * sum.s.s) % mod;

        int l = len[suff[u]] + 1, r = len[u];

        add[l] += cur;
        if (add[l] >= mod) add[l] -= mod;

        add[r + 1] -= cur;
        if (add[r + 1] < 0) add[r + 1] += mod;
    }
    return sum;
}

int main() {
    memset(to, -1, sizeof(to));
    memset(suff, -1, sizeof(suff));
    last = vn++;

    int mlen = -1;

    for (int i = 0; i < 3; ++i) {
        scanf("%s", s);
        int len = strlen(s);
        if (mlen == -1 || mlen > len) {
            mlen = len;
        }

        for (int j = 0; j < len; ++j) {
            append(s[j] - 'a');
        }
        append(27 + i);

        lp[i] = pp;
    }

    for (int i = 1; i < vn; ++i) {
        e[suff[i]].pb(i);
    }

    rec(0);

    int sum = 0;
    for (int i = 1; i <= mlen; ++i) {
        if (i > 1) putchar(' ');
        sum += add[i];
        if (sum >= mod) sum -= mod;
        printf("%d", sum);
    }
    puts("");
    return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define ll long long
#define mod 1000000007LL

int w[600010],c[600010],len,minn,maxn,last;
ll ans[300010];
char s[300010];

struct node
{
	int ch[600010][26],mx[600010],fa[600010],r[600010][4],tot;
	inline void init() { tot=1; }
	inline void add(int x,int id)
	{
		if (ch[last][x])
		{
			int np=ch[last][x],p=last;
			if (mx[np]==mx[p]+1) last=ch[p][x];
			else
			{
				int nq=++tot;
				mx[nq]=mx[p]+1;
				fa[nq]=fa[np];fa[np]=nq;
				memcpy(ch[nq],ch[np],sizeof(ch[np]));
				while (p&&ch[p][x]==np) ch[p][x]=nq,p=fa[p];
				last=nq;
			}
		}
		else
		{
			int p=last,np=++tot;
			mx[np]=mx[p]+1;last=np;
			while (!ch[p][x] && p) ch[p][x]=np,p=fa[p];
			if (!p) fa[np]=1; else
			{
				int q=ch[p][x];
				if (mx[q]==mx[p]+1) fa[np]=q;
				else
				{
					int nq=++tot;
					mx[nq]=mx[p]+1;
					memcpy(ch[nq],ch[q],sizeof(ch[q]));
					fa[nq]=fa[q];fa[q]=fa[np]=nq;
					while (p&&ch[p][x]==q) ch[p][x]=nq,p=fa[p];
				}
			}
		}
		r[last][id]++;
	}
}sam;

inline void sam_sort()
{
	for (int i=1;i<=sam.tot;i++) w[sam.mx[i]]++;
	for (int i=1;i<=maxn;i++) w[i]+=w[i-1];
	for (int i=sam.tot;i;i--) c[w[sam.mx[i]]--]=i;
}

int main()
{
	sam.init();
	minn=2123333333;maxn=0;
	for (int i=1;i<=3;i++)
	{
		scanf("%s",s+1);
		len=strlen(s+1);
		minn=min(minn,len);
		maxn=max(maxn,len);
		last=1;
		for (int j=1;j<=len;j++) sam.add(s[j]-'a',i);
	}
	sam_sort();
	for (int i=sam.tot;i;i--)
	{
		int x=c[i];
		for (int j=1;j<=3;j++) sam.r[sam.fa[x]][j]+=sam.r[x][j];
	}
	for (int i=1;i<=sam.tot;i++)
	{
		if (!sam.mx[i]) continue;
		ll hh=1LL;
		for (int j=1;j<=3;j++) hh=(hh*sam.r[i][j])%mod;
		ans[sam.mx[sam.fa[i]]+1]=(ans[sam.mx[sam.fa[i]]+1]+hh)%mod;
		ans[sam.mx[i]+1]=((ans[sam.mx[i]+1]-hh)%mod+mod)%mod;
	}
	for (int i=1;i<=minn;i++) ans[i]=(ans[i]+ans[i-1])%mod;
	for (int i=1;i<minn;i++) printf("%d ",ans[i]);
	printf("%d\n",ans[minn]);
	return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define ll long long
#define mod 1000000007LL

int w[600010],c[600010],len,minn,maxn,last;
ll ans[300010];
char s[300010];

struct node
{
	int ch[600010][26],mx[600010],fa[600010],r[600010][4],tot;
	inline void init() { tot=1; }
	inline void add(int x,int id)
	{
		if (ch[last][x])
		{
			int np=ch[last][x],p=last;
			if (mx[np]==mx[p]+1) last=ch[p][x];
			else
			{
				int nq=++tot;
				mx[nq]=mx[p]+1;
				fa[nq]=fa[np];fa[np]=nq;
				memcpy(ch[nq],ch[np],sizeof(ch[np]));
				while (p&&ch[p][x]==np) ch[p][x]=nq,p=fa[p];
				last=nq;
			}
		}
		else
		{
			int p=last,np=++tot;
			mx[np]=mx[p]+1;last=np;
			while (!ch[p][x] && p) ch[p][x]=np,p=fa[p];
			if (!p) fa[np]=1; else
			{
				int q=ch[p][x];
				if (mx[q]==mx[p]+1) fa[np]=q;
				else
				{
					int nq=++tot;
					mx[nq]=mx[p]+1;
					memcpy(ch[nq],ch[q],sizeof(ch[q]));
					fa[nq]=fa[q];fa[q]=fa[np]=nq;
					while (p&&ch[p][x]==q) ch[p][x]=nq,p=fa[p];
				}
			}
		}
		r[last][id]++;
	}
}sam;

inline void sam_sort()
{
	for (int i=1;i<=sam.tot;i++) w[sam.mx[i]]++;
	for (int i=1;i<=maxn;i++) w[i]+=w[i-1];
	for (int i=sam.tot;i;i--) c[w[sam.mx[i]]--]=i;
}

int main()
{
	sam.init();
	minn=2123333333;maxn=0;
	for (int i=1;i<=3;i++)
	{
		scanf("%s",s+1);
		len=strlen(s+1);
		minn=min(minn,len);
		maxn=max(maxn,len);
		last=1;
		for (int j=1;j<=len;j++) sam.add(s[j]-'a',i);
	}
	sam_sort();
	for (int i=sam.tot;i;i--)
	{
		int x=c[i];
		for (int j=1;j<=3;j++) sam.r[sam.fa[x]][j]+=sam.r[x][j];
	}
	for (int i=1;i<=sam.tot;i++)
	{
		if (!sam.mx[i]) continue;
		ll hh=1LL;
		for (int j=1;j<=3;j++) hh=(hh*sam.r[i][j])%mod;
		ans[sam.mx[sam.fa[i]]+1]+=hh;
		ans[sam.mx[i]+1]-=hh;
	}
	for (int i=1;i<=minn;i++) ans[i]=(ans[i]+ans[i-1])%mod;
	for (int i=1;i<minn;i++) printf("%d ",ans[i]);
	printf("%d\n",ans[minn]);
	return 0;
}