A balanced parenthesis string is defined as follows:
- The empty string is balanced
- If P is balanced, (P) is also 
- If P and Q are balanced, PQ is also balanced
You are given two even integers n$n$ and k$k$. Find any balanced paranthesis string of length n$n$ that doesn't contain a balanced substring of length k$k$, or claim that no such string exists.

-----Input-----
- First line will contain T$T$, number of testcases. Then the testcases follow. 
- Each testcase contains of a single line containing n$n$ and k$k$.

-----Output-----
For every testcase, print on a new line, any balanced paranthesis string of length n$n$ that doesn't contain a balanced substring of length k$k$. If there doesn't exist any such string, print −1$-1$ instead.

-----Constraints-----
- 1≤T≤50000$1 \leq T \leq 50000$
- 2≤k≤n≤105$2 \leq k \leq n \leq 10^5$
- Sum of n$n$ over all testcases doesn't exceed 105$10^5$.
- n$n$ and k$k$ are both even integers.

-----Example Input-----
2
4 2
8 6

-----Example Output-----
-1
(())(())

-----Explanation-----
In the first testcase, the only balanced strings of length 4$4$ are (()) and ()(), both of which contain () as a substring.
In the second testcase, (())(()) is a balanced string that doesn't contain any balanced substring of length 6$6$.

Starter code:

Solutions:
import sys


def input():
    return sys.stdin.readline().strip()


for i in range(int(input())):
    n, k = map(int, input().split())
    arr = []
    if k == 2 or k == 4 or n % 2 != 0 or n == k:
        arr.append('-1')
    elif k % 2 != 0:
        for i in range(int(n / 2)):
            arr.append('(')
        for i in range(int(n / 2)):
            arr.append(')')
    elif int(n / (k - 2)) == 1:
        if (n - 2) % 4 == 0:
            for i in range(int((n - 2) / 4)):
                arr.append('(')
            for i in range(int((n - 2) / 4)):
                arr.append(')')
            arr.append('()')
            for i in range(int((n - 2) / 4)):
                arr.append('(')
            for i in range(int((n - 2) / 4)):
                arr.append(')')
        else:
            for i in range(int((n - 4) / 4)):
                arr.append('(')
            for i in range(int((n - 4) / 4)):
                arr.append(')')
            arr.append('(())')
            for i in range(int((n - 4) / 4)):
                arr.append('(')
            for i in range(int((n - 4) / 4)):
                arr.append(')')
    else:
        for i in range(int((n % (k - 2)) / 2)):
            arr.append('(')
        for i in range(int(n / (k - 2))):
            for j in range(int((k - 2) / 2)):
                arr.append('(')
            for j in range(int((k - 2) / 2)):
                arr.append(')')
        for i in range(int((n % (k - 2)) / 2)):
            arr.append(')')

    print("".join(arr))


import sys


def input():
    return sys.stdin.readline().strip()


for i in range(int(input())):
    n, k = map(int, input().split())
    arr = []
    if k == 2 or k == 4 or n % 2 != 0 or n == k:
        arr.append('-1')
    elif k % 2 != 0:
        for i in range(int(n / 2)):
            arr.append('(')
        for i in range(int(n / 2)):
            arr.append(')')
    elif int(n / (k - 2)) == 1:
        if (n - 2) % 4 == 0:
            for i in range(int((n - 2) / 4)):
                arr.append('(')
            for i in range(int((n - 2) / 4)):
                arr.append(')')
            arr.append('()')
            for i in range(int((n - 2) / 4)):
                arr.append('(')
            for i in range(int((n - 2) / 4)):
                arr.append(')')
        else:
            for i in range(int((n - 4) / 4)):
                arr.append('(')
            for i in range(int((n - 4) / 4)):
                arr.append(')')
            arr.append('(())')
            for i in range(int((n - 4) / 4)):
                arr.append('(')
            for i in range(int((n - 4) / 4)):
                arr.append(')')
    else:
        for i in range(int((n % (k - 2)) / 2)):
            arr.append('(')
        for i in range(int(n / (k - 2))):
            for j in range(int((k - 2) / 2)):
                arr.append('(')
            for j in range(int((k - 2) / 2)):
                arr.append(')')
        for i in range(int((n % (k - 2)) / 2)):
            arr.append(')')

    print("".join(arr))





a = int(input())
while a!=0:
    b,c = map(int,input().split())
    p = c-2
    if p==0 or p==2 or b==c:
        print(-1)
    else:
        q = b//p
        r = b%p
        k=0


        if p+r == c:
            print("(", end="")
            while k != q:


                for i in range(1, p + 1):

                    if i <= (p) // 2:
                        print("(", end="")
                    else:
                        print(")", end="")
                k+=1

            print(")")

            a-=1
            print()
            continue

        while k!=q:

            for i in range(1,p+1):

                if i<= p//2:
                    print("(",end="")
                else:
                    print(")",end="")
            k+=1
        for i in range(1,r+1):
            if i<=r//2:
                print("(",end="")
            else:
                print(")",end="")


        print()


    a-=1




a = int(input())
while a!=0:
    b,c = map(int,input().split())
    p = c-2
    if p==0 or p==2 or b==c:
        print(-1)
    else:
        q = b//p
        r = b%p
        k=0


        if p+r == c:
            print("(", end="")
            while k != q:


                for i in range(1, p + 1):

                    if i <= (p) // 2:
                        print("(", end="")
                    else:
                        print(")", end="")
                k+=1

            print(")")

            a-=1
            print()
            continue

        while k!=q:

            for i in range(1,p+1):

                if i<= p//2:
                    print("(",end="")
                else:
                    print(")",end="")
            k+=1
        for i in range(1,r+1):
            if i<=r//2:
                print("(",end="")
            else:
                print(")",end="")


        print()


    a-=1