n = int(input()) s = input() ans = [1]*n st = [] for i,si in enumerate(s): if si=="(": st.append(i) else: v = st.pop() ans[i] += v ans[v] += i print(*ans,sep="\n")