Problem: Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: 

  1. The product of all numbers in the first set is less than zero ( < 0). 
  2. The product of all numbers in the second set is greater than zero ( > 0). 
  3. The product of all numbers in the third set is equal to zero. 
  4. Each number from the initial array must occur in exactly one set. 



Help Vitaly. Divide the given array.

Input

The first line of the input contains integer n (3 ≤ n ≤ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≤ 103) — the array elements.

Output

In the first line print integer n1 (n1 > 0) — the number of elements in the first set. Then print n1 numbers — the elements that got to the first set.

In the next line print integer n2 (n2 > 0) — the number of elements in the second set. Then print n2 numbers — the elements that got to the second set.

In the next line print integer n3 (n3 > 0) — the number of elements in the third set. Then print n3 numbers — the elements that got to the third set.

The printed sets must meet the described conditions. It is guaranteed that the solution exists. If there are several solutions, you are allowed to print any of them.

Examples

Input

3
-1 2 0


Output

1 -1
1 2
1 0


Input

4
-1 -2 -3 0


Output

1 -1
2 -3 -2
1 0

Solution (in JAVA):

Solution:
import java.util.*;
import java.io.*;
public class Main {
      static class pair implements Comparable<pair>{
        int x;
        int y;
        public pair(int x, int y){
            this.x=x;
            this.y=y;
        }
        public int compareTo(pair p){
            return (x-p.x==0)?y-p.y:x-p.x;
        }
    }
     static class SegmentTree {
        int N;
        int[] st, lazy;
 
        public SegmentTree(int n) {
            N = n;
            st = new int[N << 1];
            lazy = new int[N << 1];
        }
 
        void update_range(int i, int j) {
            update_range(1, 1, N, i, j);
        }
 
        void update_range(int node, int b, int e, int i, int j) {
            if (i > e || j < b)
                return;
            if (b >= i && e <= j) {
                st[node] += (e - b + 1);
                lazy[node]++;
                return;
            }
            int mid = (b + e) >> 1;
            propagate(node, b, mid, e);
            update_range(node << 1, b, mid, i, j);
            update_range(node << 1 | 1, mid + 1, e, i, j);
            st[node] = st[node << 1] + st[node << 1 | 1];
 
        }
 
        void propagate(int node, int b, int mid, int e) {
            lazy[node << 1] += lazy[node];
            lazy[node << 1 | 1] += lazy[node];
            st[node << 1] += (mid - b + 1) * lazy[node];
            st[node << 1 | 1] += (e - mid) * lazy[node];
            lazy[node] = 0;
        }
 
        int query(int i, int j) {
            return query(1, 1, N, i, j);
        }
 
        int query(int node, int b, int e, int i, int j) {
            if (i > e || j < b)
                return 0;
            if (b >= i && e <= j)
                return st[node];
            int mid = (b + e) >> 1;
            propagate(node, b, mid, e);
            int q1 = query(node << 1, b, mid, i, j);
            int q2 = query(node << 1 | 1, mid + 1, e, i, j);
            return q1 + q2;
        }
    }
  public static void main(String[] args) throws IOException,InterruptedException{
	BufferedReader	 br = new BufferedReader(new InputStreamReader(System.in));
	PrintWriter out = new PrintWriter(System.out);
     	// String s = br.readLine();
        // char[] arr=s.toCharArray();
        // ArrayList<Integer> arrl = new ArrayList<Integer>(); 
        // TreeSet<Integer> ts1 = new TreeSet<Integer>(); 
        // HashSet<Integer> h = new HashSet<Integer>(); 
        // HashMap<Integer, Integer> map= new HashMap<>(); 
        // PriorityQueue<String> pQueue = new PriorityQueue<String>(); 
        // LinkedList<String> object = new LinkedList<String>(); 
        // StringBuilder str = new StringBuilder(); 
 	    StringTokenizer   st = new StringTokenizer(br.readLine());
 	      int n = Integer.parseInt(st.nextToken());
          int[] arr = new int[n]; 
          ArrayList<Integer> neg = new ArrayList<Integer>(); 
          ArrayList<Integer> pos = new ArrayList<Integer>(); 
          ArrayList<Integer> zer = new ArrayList<Integer>(); 
            st = new StringTokenizer(br.readLine());
 	      for(int i=0; i<n; i++){
 	          arr[i] = Integer.parseInt(st.nextToken());
 	          if(arr[i]>0) pos.add(arr[i]);
 	          else if(arr[i]<0) neg.add(arr[i]);
 	          else zer.add(arr[i]);
 	      }
 	      if(neg.size()%2==0) zer.add(neg.remove(0));
 	      if(pos.size()==0&&neg.size()>2){
 	          pos.add(neg.remove(0));
 	          pos.add(neg.remove(0));
 	      }
 	      out.print(neg.size()+" ");
 	      for(int i=0; i<neg.size();i++){
 	          out.print(neg.get(i)+" ");
 	      }out.println();
 	      out.print(pos.size()+" ");
 	      for(int i=0; i<pos.size(); i++){
 	          out.print(pos.get(i)+" ");
 	      }out.println();
 	      out.print(zer.size()+" ");
 	      for(int i=0; i<zer.size(); i++){
 	          out.print(zer.get(i)+" ");
 	      }out.println();
 	      
       	out.flush();
 
	}}