Buggy python submission (verdict: Time Limit Exceeded):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def inv(a):
    n = mod - 2
    r = 1
    while n > 0:
        if n % 2 == 1:
            r = r * a % mod
        a = a * a % mod
        n >>= 1
    return r

def nCb(n, b):
    if b > n - b:
        b = n - b
    r = 1
    for k in range(n, n-b, -1):
        r = r * k % mod
    d = 1
    for k in range(1, b+1):
        d = d * k % mod
    return r * inv(d) % mod


def main():
    n = I()
    a = LI_()
    b = [-1] * n
    t = 1
    for i in range(n+1):
        c = a[i]
        if b[c] >= 0:
            t = i - b[c]
            break
        b[c] = i

    rr = [n]
    for i in range(2,n+2):
        tr = nCb(n+1,i)
        if n-t >= i-1:
            tr -= nCb(n-t, i-1)
            tr %= mod
        rr.append(tr)
    return '\n'.join(map(str, rr))

print(main())





Fixed submission:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def M(n): return ModInt(n)
def MI(): return M(I())

class ModInt():
    def __init__(self, n):
        self.n = n

    def __add__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n+x) % mod)

    def __sub__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n-x) % mod)

    def __mul__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n*x) % mod)

    def __truediv__(self, x):
        x = ModInt.xn(x)
        return ModInt(self.n * pow(x, mod-2, mod) % mod)

    @classmethod
    def xn(cls, x):
        if isinstance(x, ModInt):
            return x.n
        return x

    def __str__(self):
        return str(self.n)

def main():
    n = I()
    a = LI_()
    b = [-1] * n
    t = 1
    for i in range(n+1):
        c = a[i]
        if b[c] >= 0:
            t = i - b[c]
            break
        b[c] = i

    rr = [n]
    nb = M(n+1)
    nt = M(1)
    for i in range(2,n+2):
        nb *= n-i+2
        nb /= i

        tr = nb.n
        if n-t >= i-1:
            nt *= n-t-i+2
            nt /= i-1
            tr -= nt.n
            tr %= mod
        rr.append(tr)
    return '\n'.join(map(str, rr))

print(main())

Buggy python submission (verdict: Time Limit Exceeded):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def inv(a):
    n = mod - 2
    r = 1
    while n > 0:
        if n % 2 == 1:
            r = r * a % mod
        a = a * a % mod
        n >>= 1
    return r

def nCb(n, b):
    if b > n - b:
        b = n - b
    r = 1
    for k in range(n, n-b, -1):
        r = r * k % mod
    d = 1
    for k in range(1, b+1):
        d = d * k % mod
    return r * inv(d) % mod


def main():
    n = I()
    a = LI_()
    b = [-1] * n
    t = 1
    for i in range(n+1):
        c = a[i]
        if b[c] >= 0:
            t = i - b[c]
            break
        b[c] = i

    rr = [n]
    for i in range(2,n+2):
        tr = nCb(n+1,i)
        if n-t >= i-1:
            tr -= nCb(n-t, i-1)
            tr %= mod
        rr.append(tr)
    return '\n'.join(map(str, rr))

print(main())





Fixed submission:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def M(n): return ModInt(n)
def MI(): return M(I())

class ModInt():
    def __init__(self, n):
        self.n = n

    def __add__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n+x) % mod)

    def __sub__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n-x) % mod)

    def __mul__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n*x) % mod)

    def __truediv__(self, x):
        x = ModInt.xn(x)
        return ModInt(self.n * pow(x, mod-2, mod) % mod)

    @classmethod
    def xn(cls, x):
        if isinstance(x, ModInt):
            return x.n
        return x

    def __str__(self):
        return str(self.n)

def main():
    n = I()
    a = LI_()
    b = [-1] * n
    t = 1
    for i in range(n+1):
        c = a[i]
        if b[c] >= 0:
            t = i - b[c]
            break
        b[c] = i

    rr = [n]
    nb = M(n+1)
    nt = M(1)
    for i in range(2,n+2):
        nb *= n-i+2
        nb /= i

        tr = nb.n
        if n-t >= i-1:
            nt *= n-t-i+2
            nt /= i-1
            tr -= nt.n
            tr %= mod
        rr.append(tr)
    return '\n'.join(map(str, rr))

print(main())