Question
Secrets of the Ancient Vault

You are a treasure seeker exploring an ancient vault filled with numbered magical stones, each stone represented by an element in the array nums.

Legends say that certain combinations of these stones unlock hidden chambers — but only those groups whose total power adds up exactly to the sacred number target.

Your mission is to discover and return every possible collection of stones whose combined power equals the target value. Only these special subsets can reveal the secrets of the vault.

Input
The first line contains an integer n
The next line contains n space-separated integers as input representing the nums.
The third line contains an integer representing target
Output
Print all the magical stone collections that unlock the hidden chambers — that is, every group of stones whose combined power equals the sacred target. Each collection must follow the order in which the stones appear in the vault.
If no such collection is found, print "-1", as no chamber can be unlocked.
Example
Sample Input
4
1 2 3 4
6
Sample Output
1 2 3
2 4
Note
In the result, observe that, Because the number 1 comes before 2 in the provided array, all arrays containing 1 are listed before arrays containing 2 in the output.

Online