558. Print Unique Triplets

0

Medium

Given an array of integers nums, find all unique triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and the sum of the three integers is equal to zero.
Note that the solution set must not contain duplicate triplets.

Input Format

The first line contains the size of the array.

The second line contains the elements of the array.

The second line contains the elements of the array.

Output Format

Print a 2D list.

Example

Input

6
-1 0 1 2 -1 -4

Output

[[-1, -1, 2], [-1, 0, 1]]

Constraints

3 <= nums.length <= 3000

-10

-10

^{5}<= nums[i] <= 10^{5}Loading...

View Submissions

Console