Time limit per test

2 seconds

Memory limit per test

256 megabytes

Input

Standard Input

Output

Standard output

Vitaly has an array*N*Distinct integers. Vitaly wants to divide this array into three non-empty Sets

So as the following conditions hold:

- The product of all numbers in the first set is less than zero (cost <limit 0 ).
- The product of all numbers in the second set is greater than zero (Priority> limit 0 ).
- The product of all numbers in the third set is equal to zero.
- 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 cores ≤ Cores*N*Limit ≤ limit 100 ).

The second line contains*N*Space-separated distinct integers*A*_{1, bytes,A2, middle..., middle ,...,AN(|AI| Limit ≤ limit 103 )-The array elements.}

Output

In the first line print integer*N*_{1 (N1 rows> limit 0 )-The number of elements in the first set. Then printN1 Numbers-The elements that got to the first set.}

In the next line print integer*N*_{2 (N2 rows> limit 0 )-The number of elements in the second set. Then printN2 numbers-The elements that got to the second set.}

In the next line print integer*N*_{3 (N3 rows> limit 0 )-The number of elements in the third set. Then printN3 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.

Sample test (s) Input

3-1 2 0

Output

1 -11 21 0

Input

4-1 -2 -3 0

Output

1 -12 -3 -21 0

Description: The requirement for this question is to group the number of columns. The product of the numbers to the first group must be smaller than 0, the product of the second group must be greater than 0, and the product of the third group must be zero. sort the array first, put the smallest number in the first group, and then judge whether there are any numbers greater than 0 in the array, put the smallest number greater than 0 in the second group, and put all the other numbers in the third group. [there must be a 0 in the question.] If there is no number greater than 0, put the two negative numbers in the second group [the product is greater than 0], and the other numbers in the third group.

#include <iostream>#include <cstdio>#include <cstdlib>#include <cmath>#include <cstring>#include <string>#include <algorithm>using namespace std;int main() {int i,n,a[100],k;scanf("%d",&n);for(i=0;i<n;i++){scanf("%d",&a[i]);}sort(a,a+n);cout<<1<<" "<<a[0]<<endl;k=0;for(i=0;i<n;i++){if(a[i]>0) {cout<<1<<" "<<a[i]<<endl;k=a[i];break;}}if(k>0) {cout<<n-2<<" ";for(i=1;i<n;i++){if(a[i]!=k) {cout<<a[i]<<" ";}}}else{cout<<2<<" "<<a[1]<<" "<<a[2]<<endl<<n-3<<" ";for(i=3;i<n;i++){cout<<a[i]<<" ";}}return 0;}