open System
open System.Collections.Generic

module InputUtility =
    let InputTokens = new Queue<string>()

    let EnsureInput () =
        if InputTokens.Count = 0 then
            let input = Console.ReadLine ()
            let s = input.Split ([|' '|], StringSplitOptions.RemoveEmptyEntries)
            if s.Length > 0 then
                for x in s do InputTokens.Enqueue(x)
                true
            else false
        else true

    let rec ReadNext () =
        if EnsureInput () then InputTokens.Dequeue ()
        else ReadNext ()

    let ReadNextInt () = ReadNext () |> int

    let Read2Int () = ReadNextInt (), ReadNextInt ()

    let Read3Int () = ReadNextInt (), ReadNextInt (), ReadNextInt ()

    let ReadListOf f n =
        let rec loop acc = function
            | 0 -> List.rev acc
            | c -> loop ((ReadNext () |> f) :: acc) (c-1)
        loop [] n

    let MultipleCaseWithId f =
        let caseNum = ReadNextInt ()
        let rec loop index =
            if index = caseNum then ()
            else
                f index
                loop (index + 1)
        loop 0

    let MultipleCase f = MultipleCaseWithId (fun _ -> f ())

    let ReadList n =
        let rec loop acc = function
            | 0 -> List.rev acc
            | c -> loop (ReadNext () :: acc) (c-1)
        loop [] n

open InputUtility

module ARC077 =
    let private Mod = 1000000007L

    let rec extendedGcdInt64 x y =
        let c, z = y / x, y % x
        if z = 0L then 1L, 0L, x
        else
            let a, b, r = extendedGcdInt64 z x
            b - a * c, a, r

    (* Returns (a, b, r) where r is the GCD of x and y, and
            a * x + b * y = r (Equ1)
       There are many other possible pairs of a, b getting
       Equ1 true, however, all of them are in below pattern:
            a + k * y / r, b - k * x / r *)
    let extendedGcd x y =
        let a, b, r = extendedGcdInt64 (int64 x) (int64 y)
        int a, int b, int r

    (* Returns r = x % p where 0<=r<p *)
    let inMod p x = let r = x % p in if r < 0L then r + p else r

    (* Returns (i, r) where r is the GCD of p and x, and
            x * i % p = r *)
    let getInverseInt64 p x =
        let a, _, r = extendedGcdInt64 x p
        inMod p a, r
    let prepareC p u =
        let g () = Array.zeroCreate (u + 1)
        let sn, rn = g (), g ()
        let rec loop i cs cr =
            if i <= u then
                sn.[i] <- cs
                rn.[i] <- cr
                let ni = i + 1
                let ni64 = ni |> int64
                let ns = cs * ni64 % p
                let ri, _ = getInverseInt64 p ni64
                let nr = cr * ri % p
                loop ni ns nr
        loop 0 1L 1L
        fun m k ->
            if m < 0 || u < m then invalidArg "m" "base too large"
            if k < 0 || m < k then 0L
            else sn.[m] * rn.[k] % p * rn.[m - k] % p

    let private Oneone () =
        let n = ReadNextInt ()
        let arr = ReadListOf int (n + 1)
        let v = [1..n] @ arr |> Seq.reduce (^^^)
        let err f = if f then invalidArg "arr" "invalid input array"
        err (v < 1 || n < v)
        let pv =
            arr
            |> Seq.mapi (fun i x -> i, x)
            |> Seq.where (fun (i, x) -> x = v)
            |> Seq.map fst
            |> Seq.toArray
        err (pv.Length <> 2)
        let a, b, c = pv.[0], pv.[1] - pv.[0] - 1, n - pv.[1]
        //printfn "%d-> %d %d %d" v a b c
        let calC = prepareC Mod (n + 1)
        let rec showRes i =
            if i <= n + 1 then
                let r0 = calC (n - 1) i
                let r1t = calC (n - 1) (i - 1)
                let r1a = calC (a + c) (i - 1)
                let r2 = calC (n - 1) (i - 2)
                let cr = (r0 + (r1t * 2L - r1a + Mod) + r2) % Mod
                printfn "%d" cr
                showRes (i + 1)
        showRes 1

    let Entry = Oneone

ARC077.Entry ()

Measured memory_bytes: 40532