LearnPy Hub
← Arena
IntermediateRating 1200

Subsets With Bitmasks

Print every subset of the given distinct numbers using bitmasks: for mask = 0, 1, 2, …, 2ⁿ − 1, print the numbers whose bit is set (bit i ↔ the i-th number), in input order. Print an empty subset as a single dash -.

Input

n (≤ 10), then n distinct integers.

Output

2ⁿ lines.

Sample 1

Input
3
1 2 3
Output
-
1
2
1 2
3
1 3
2 3
1 2 3

Sample 2

Input
1
9
Output
-
9
solution.py
Output appears here
Subsets With Bitmasks · Python Arena problem · LearnPy Hub