Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]
mod = 7 + 10 ** 9

def Pow(i, n):
    if n == 0:
        return 1
    else:
        ans = Pow(i * i % mod, n//2)
        if n % 2 == 1:
            ans *= i
            ans %= mod
        return ans

Nfact = [1]
NfactRev = []
for i in range(1, N+2):
    Nfact.append((Nfact[i-1] * (i)) % mod)
    if A.count(i) == 2:
        Double = [A.index(i), A[::-1].index(i)]
NfactRev.append(Pow(Nfact[N+1], mod-2))
for i in range(1, N+1):
    NfactRev.append(NfactRev[i-1] * (N+2-i) % mod)
NfactRev.append(1)

doublearray = Double[0] + Double[1]
for i in range(1, N+2):
    whole = Nfact[N+1] * NfactRev[-(N+2-i)] * NfactRev[-(i+1)] % mod
    if i <= doublearray+1:
        double = Nfact[doublearray] * NfactRev[-(doublearray-i+2)] * NfactRev[-i] % mod
    else:
        double = 0
    print(whole - double)

Fixed submission:
def Pow(i, n):
    if n == 0:
        return 1
    else:
        ans = Pow(i * i % mod, n//2)
        if n % 2 == 1:
            ans *= i
            ans %= mod
        return ans

N = int(input())
A = [int(i) for i in input().split()]
mod = 7 + 10 ** 9
num = [-1 for i in range(N)]
for i, a in enumerate(A):
    if num[a-1] == -1:
        num[a-1] = i
    else:
        Double = [num[a-1], i]

Nfact = [1]
for i in range(1, N+2):
    Nfact.append((Nfact[i-1] * (i)) % mod)
NfactRev = [Pow(Nfact[N+1], mod-2)]
for i in range(1, N+1):
    NfactRev.append(NfactRev[i-1] * (N+2-i) % mod)
NfactRev.append(1)
NfactRev.reverse()

doublearray = N + 1 - (Double[1] - Double[0])
for i in range(1, N+2):
    whole = Nfact[N+1] * NfactRev[N+1-i] * NfactRev[i] % mod
    if i <= doublearray:
        double = Nfact[doublearray-1] * NfactRev[doublearray-i] * NfactRev[i-1] % mod
    else:
        double = 0
    print((whole - double) % mod)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]
mod = 7 + 10 ** 9

def Pow(i, n):
    if n == 0:
        return 1
    else:
        ans = Pow(i * i % mod, n//2)
        if n % 2 == 1:
            ans *= i
            ans %= mod
        return ans

Nfact = [1]
NfactRev = []
for i in range(1, N+2):
    Nfact.append((Nfact[i-1] * (i)) % mod)
    if A.count(i) == 2:
        Double = [j for j, x in enumerate(A) if x == i]
NfactRev.append(Pow(Nfact[N+1], mod-2))
for i in range(1, N+1):
    NfactRev.append(NfactRev[i-1] * (N+2-i) % mod)
NfactRev.append(1)

doublearray = N - (Double[1] - Double[0])
for i in range(1, N+2):
    whole = Nfact[N+1] * NfactRev[-(N+2-i)] * NfactRev[-(i+1)] % mod
    if i <= doublearray+1:
        double = Nfact[doublearray] * NfactRev[-(doublearray-i+2)] * NfactRev[-i] % mod
    else:
        double = 0
    print(whole - double)

Fixed submission:
def Pow(i, n):
    if n == 0:
        return 1
    else:
        ans = Pow(i * i % mod, n//2)
        if n % 2 == 1:
            ans *= i
            ans %= mod
        return ans

N = int(input())
A = [int(i) for i in input().split()]
mod = 7 + 10 ** 9
num = [-1 for i in range(N)]
for i, a in enumerate(A):
    if num[a-1] == -1:
        num[a-1] = i
    else:
        Double = [num[a-1], i]

Nfact = [1]
for i in range(1, N+2):
    Nfact.append((Nfact[i-1] * (i)) % mod)
NfactRev = [Pow(Nfact[N+1], mod-2)]
for i in range(1, N+1):
    NfactRev.append(NfactRev[i-1] * (N+2-i) % mod)
NfactRev.append(1)
NfactRev.reverse()

doublearray = N + 1 - (Double[1] - Double[0])
for i in range(1, N+2):
    whole = Nfact[N+1] * NfactRev[N+1-i] * NfactRev[i] % mod
    if i <= doublearray:
        double = Nfact[doublearray-1] * NfactRev[doublearray-i] * NfactRev[i-1] % mod
    else:
        double = 0
    print((whole - double) % mod)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]
mod = 7 + 10 ** 9

def Pow(i, n):
    if n == 0:
        return 1
    else:
        ans = Pow(i * i % mod, n//2)
        if n % 2 == 1:
            ans *= i
            ans %= mod
        return ans

Nfact = [1]
NfactRev = [1]
for i in range(1, N+2):
    Nfact.append((Nfact[i-1] * (i)) % mod)
    NfactRev.append((NfactRev[i-1] * Pow(i, mod - 2)) % mod)
    if A.count(i) == 2:
        Double = [j for j, x in enumerate(A) if x == i]

doublearray = N - (Double[1] - Double[0])
for i in range(1, N+2):
    whole = Nfact[N+1] * NfactRev[N+1-i] * NfactRev[i] % mod
    if i <= doublearray+1:
        double = Nfact[doublearray] * NfactRev[doublearray-i+1] * NfactRev[i-1] % mod
    else:
        double = 0
    print(whole - double)

Fixed submission:
def Pow(i, n):
    if n == 0:
        return 1
    else:
        ans = Pow(i * i % mod, n//2)
        if n % 2 == 1:
            ans *= i
            ans %= mod
        return ans

N = int(input())
A = [int(i) for i in input().split()]
mod = 7 + 10 ** 9
num = [-1 for i in range(N)]
for i, a in enumerate(A):
    if num[a-1] == -1:
        num[a-1] = i
    else:
        Double = [num[a-1], i]

Nfact = [1]
for i in range(1, N+2):
    Nfact.append((Nfact[i-1] * (i)) % mod)
NfactRev = [Pow(Nfact[N+1], mod-2)]
for i in range(1, N+1):
    NfactRev.append(NfactRev[i-1] * (N+2-i) % mod)
NfactRev.append(1)
NfactRev.reverse()

doublearray = N + 1 - (Double[1] - Double[0])
for i in range(1, N+2):
    whole = Nfact[N+1] * NfactRev[N+1-i] * NfactRev[i] % mod
    if i <= doublearray:
        double = Nfact[doublearray-1] * NfactRev[doublearray-i] * NfactRev[i-1] % mod
    else:
        double = 0
    print((whole - double) % mod)