Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

The problem statement has recently been changed. View the changes.

×
E. Arthur and Brackets

time limit per test

2 secondsmemory limit per test

128 megabytesinput

standard inputoutput

standard outputNotice that the memory limit is non-standard.

Recently Arthur and Sasha have studied correct bracket sequences. Arthur understood this topic perfectly and become so amazed about correct bracket sequences, so he even got himself a favorite correct bracket sequence of length 2*n*. Unlike Arthur, Sasha understood the topic very badly, and broke Arthur's favorite correct bracket sequence just to spite him.

All Arthur remembers about his favorite sequence is for each opening parenthesis ('(') the approximate distance to the corresponding closing one (')'). For the *i*-th opening bracket he remembers the segment [*l*_{i}, *r*_{i}], containing the distance to the corresponding closing bracket.

Formally speaking, for the *i*-th opening bracket (in order from left to right) we know that the difference of its position and the position of the corresponding closing bracket belongs to the segment [*l*_{i}, *r*_{i}].

Help Arthur restore his favorite correct bracket sequence!

Input

The first line contains integer *n* (1 ≤ *n* ≤ 600), the number of opening brackets in Arthur's favorite correct bracket sequence.

Next *n* lines contain numbers *l*_{i} and *r*_{i} (1 ≤ *l*_{i} ≤ *r*_{i} < 2*n*), representing the segment where lies the distance from the *i*-th opening bracket and the corresponding closing one.

The descriptions of the segments are given in the order in which the opening brackets occur in Arthur's favorite sequence if we list them from left to right.

Output

If it is possible to restore the correct bracket sequence by the given data, print any possible choice.

If Arthur got something wrong, and there are no sequences corresponding to the given information, print a single line "IMPOSSIBLE" (without the quotes).

Examples

Input

4

1 1

1 1

1 1

1 1

Output

()()()()

Input

3

5 5

3 3

1 1

Output

((()))

Input

3

5 5

3 3

2 2

Output

IMPOSSIBLE

Input

3

2 3

1 4

1 4

Output

(())()

Codeforces (c) Copyright 2010-2021 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Apr/12/2021 18:14:08 (i2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|