import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
List<List> ansList = getRst(new int[] { 0, 0, 5 });
for (List list : ansList) {
for (int i : list) {
System.out.print(i + " ");
}
System.out.println();
}
}
public static List<List<Integer>> getRst(int[] nums) {
Arrays.sort(nums);
List<List<Integer>> ansList = new ArrayList<>();
for (int first = 0; first < nums.length; first++) {
if (first != 0 && nums[first] == nums[first - 1]) {
continue;
}
int target = -nums[first];
int second = first + 1;
int third = nums.length - 1;
while (second < third) {
if (nums[second] + nums[third] == target) {
List<Integer> list = new ArrayList<>();
list.add(nums[first]);
list.add(nums[second]);
list.add(nums[third]);
ansList.add(list);
do {
second++;
} while (second < third && nums[second - 1] == nums[second]);
}
while (second < third && nums[second] + nums[third] > target) {
third--;
}
while (second < third && nums[second] + nums[third] < target) {
second++;
}
}
}
return ansList;
}
}