using System; using System.Collections.Generic; namespace y { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); string s = Console.ReadLine(); int[] a = new int[n]; var li = new List(); for (int i = 0; i < n; i++) { if (s[i] == '(') { li.Add(i); } else { a[li[li.Count - 1]] = i; a[i] = li[li.Count - 1]; li.RemoveAt(li.Count - 1); } } foreach (var ans in a) { Console.WriteLine(ans + 1); } } } }