import java.util.Scanner; //最长和为0的数组 public class Main2 { //1 2 3 4 -1 -2 -4 -3 1 2 public static void main(String[] args) { // TODO Auto-generated method stub Scanner input=new Scanner(System.in); String[] data=input.nextLine().split(" "); int[] data1=new int[data.length]; for(int i=0;i<data1.length;i++){ data1[i]=Integer.valueOf(data[i]); } for(int i=0;i<data1.length;i++){ int sum=0; StringBuffer resoult=new StringBuffer(); for(int j=0;j<data1.length-i&&j<data1.length;j++){ String temp=data1[j]+""; resoult.append(temp+" "); sum+=data1[j]; } if(sum==0){ System.out.println(resoult); System.exit(0); } } } }