403165: GYM101055 H Zé Coquinho, the sculptor
Description
Zé Coquinho is a famous artisan that makes sculptures with coconuts. The dried coconuts are cut in half and bows are made with the shells, and used to build sculptures. The sculptures are very famous, and are searched by collectors all over the world.
Zé Coquinho's sculptures are sequences os bowls glued to each other. A bowl open to the left is represented as ')' and a bowl open to the right is represented as '('. A well-formed sculpture is defined the following way:
- An empty sequence of bowls is well-formed.
- If T is well-formed, then (T) is well-formed.
- If S and T are well-formed, the ST is well-formed.
A marking characteristic of Zé Coquinho's sculptures is that they are never well-formed.
The Museum of Modern Art of Graviúna wants to make an exposition of Zé Coquinho's works. To organize the exposition, the museum decided to ordem the sculptures in lexicographic order. The museum considers '(' comes before ')' so, for example, "(((" < "(()" < ")((". The size of an sculpture is the number of bowls used in it.
Given N and K, you should determine the Kth sculpture Zé Coquinho made, in lexicographic order. You can consider Zé Coquinho created all possible non-well-formed sculptures of size N.
InputThe first line has a single integer Q, the number of queries.
Each of the next Q lines has two integers N and K.
Limits
- 1 ≤ Q ≤ 200
- 1 ≤ N ≤ 50
- 1 ≤ K ≤ 2N
For each query, print a single line, the Kth sculpture of size N made by Coquinho, in lexicographic order. If there is no such sculpture, print "-1" instead.
ExampleInput4Output
4 1
4 5
6 64
7 14
((((
())(
-1
((())()