Balanced Parantheses Problem

How do we print the brackets in sorted manner?

eg. n=2
output:-

( ) ( )

( ( ) )

Rather than

( ( ) )

( ) ( )