Skip to content
UPEEC

All Subsets

Medium#recursion#backtracking#bit-manipulation· solved by 0 · time limit 2.0 s

Print every distinct subset of the numbers. Write each subset's elements in increasing order. List subsets by size, and same-size subsets in lexicographic order of their numbers. Print the empty subset as {}.

Input

nn, then nn integers.

Output

One subset per line.

Constraints

1≤n≤101 \le n \le 10

Sample 1

Input

3
1 2 3

Output

{}
1
2
3
1 2
1 3
2 3
1 2 3

Sample 2

Input

3
2 1 2

Output

{}
1
2
1 2
2 2
1 2 2

Sign in or join free to run and submit your solution.