import java.util.Scanner; public class No592 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); String S = sc.next(); String str[] = S.split(""); int taiou[] = new int[N]; for(int i = 0;i < N;i++) { if(str[i].equals("(")){ int cnt = 1; for(int j = i+1;j < N;j++) { if(str[j].equals("(")) { cnt++; }else { cnt--; } if(cnt == 0) { taiou[i] = j+1; taiou[j] = i+1; break; } } } } for(int i = 0;i < N;i++) { System.out.println(taiou[i]); } } }