import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class SolutionIvanRecursiveFullLoops {
    public static void main(String[] args) throws IOException {
        new SolutionIvanRecursiveFullLoops().run();
    }

    BufferedReader input;
    StringTokenizer tokenizer;
    String next() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(input.readLine());
        }
        return tokenizer.nextToken();
    }
    int nextInt() {
        try {
            return Integer.parseInt(next());
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    static final int MOD = 1000000007;
    int n;
    List<List<Integer>> g;
    int p[];
    int pi[];
    int count[];

    int z[][];

    static int mul(int lhs, int rhs) {
        return (int)(((long)lhs * (long)rhs) % MOD);
    }

    int solve(int v, int c) {
        if (c == 0) {
            return 1;
        }
        if (z[v][c] == -1) {
            int u = p[v];
            if (pi[v] + 1 == g.get(u).size()) {
                if (g.get(v).isEmpty()) {
                    z[v][c] = (c == 1) ? 1 : 0;
                } else {
                    z[v][c] = solve(g.get(v).get(0), c - 1);
                }
            } else {
                int s = g.get(u).get(pi[v] + 1);
                int total = solve(s, c);
                for (int left = 1; left <= c; ++left) {
                    int cur = solve(s, c - left);
                    if (g.get(v).isEmpty()) {
                        if (left != 1) {
                            cur = 0;
                        }
                    } else {
                        cur = mul(cur, solve(g.get(v).get(0), left - 1));
                    }
                    total = (total + cur) % MOD;
                }
                z[v][c] = total;
            }
        }
        return z[v][c];
    }

    public void run() throws IOException {
        input = new BufferedReader(new InputStreamReader(System.in));
        n = nextInt();
        g = new ArrayList<>(n);
        for (int i = 0; i < n; ++i) {
            g.add(new ArrayList<>(n));
        }

        p = new int[n];
        pi = new int[n];
        count = new int[n];
        Arrays.fill(count, 0);

        p[0] = -1;
        pi[0] = 0;
        count[0] = 1;

        for (int v = 1; v < n; ++v) {
            p[v] = nextInt();
            pi[v] = g.get(p[v]).size();
            g.get(p[v]).add(v);

            int u = v;
            while (u != -1) {
                ++count[u];
                u = p[u];
            }
        }

        z = new int[n][n + 1];
        for (int i = 0; i < n; ++i) {
            Arrays.fill(z[i], -1);
        }

        for (int c = 1; c <= n; ++c) {
            int total = 0;
            for (int v = 0; v < n; ++v) {
                int cur;
                if (g.get(v).isEmpty()) {
                    cur = (c == 1) ? 1 : 0;
                } else {
                    cur = solve(g.get(v).get(0), c - 1);
                }
                total = (total + cur) % MOD;
            }
            System.out.println(total);
        }
    }
}
