380. Subsets II

0

Medium

Given an array of integers, arr, which may contain duplicates, find all possible subsets (the power set) without any duplicate subsets. The subsets must be printed in lexicographically sorted order, with each subset on a new line. Please ensure that the output format matches the provided sample output.

Input Format

The first line of input should contain an integer, N, representing the size of the array. The second line should contain N space-separated integers, describing the elements of the array.

Output Format

Print all possible subsets, with each subset on a new line and all subsets in sorted order.

Example

Input

3
1 2 2

Output

1
1 2
1 2 2
2
2 2

Constraints

1<=N<=10

-100<=arr[i]<=100

-100<=arr[i]<=100

Loading...

View Submissions

Console