import java.util.*;
public class Main {
static int idx;
static int[] ans = new int[100010];
static ArrayList<int[]> list = new ArrayList<>();
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.nextLine());
char[] chs = sc.nextLine().toCharArray();
Stack<int[]> stack = new Stack<>();
for (int i = 0; i < 2 * n; i++) {
if (chs[i] == '(') {
stack.push(new int[] {++idx, (int)chs[i]});
}
else {
if (stack.isEmpty()) {
System.out.println(-1);
return;
}
int[] t = stack.pop();
list.add(new int[]{t[0], stack.size() + 1});
}
}
if (!stack.isEmpty()) {
System.out.println(-1);
return;
}
list.sort((o1, o2) -> o1[0] - o2[0]);
for (int[] item : list) {
System.out.print(n - item[1] + " ");
}
}
}