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 PYTHON3):

Solution:
#	✪ H4WK3yE乡
#	Mayank Chaudhary
#	ABES EC , Ghaziabad
# ///==========Libraries, Constants and Functions=============///
import sys
from bisect import bisect_left,bisect_right
from collections import deque,Counter
from math import gcd,sqrt,factorial,ceil,log10
from itertools import permutations
inf = float("inf")
mod = 1000000007
mini=1000000007


def ncr(n,r):                                                          # < ------ To calculate nCr mod p value using Fermat Little under modulo m
    d=10**9+7
    num=fact(n)
    den=(fact(r)*fact(n-r))%d
    den=pow(den,d-2,d)
    return (num*den)%d

def sieve(n):                                                          # <----- sieve of eratosthenes for prime no.
    prime=[True for i in range(n+1)]
    lst=[]
    p=2
    while p*p<=n:
        if prime[p]:
            for i in range(p*p,n+1,p):
                prime[i]=False
        p=p+1
    for i in range(2,n+1):
        if prime[i]:
            lst.append(i)
    return lst
    
        
def binary(number):                                             #  <----- calculate the no. of 1's in binary representation of number
    result=0
    while number:
        result=result+1
        number=number&(number-1)
    return result

def calculate_factors(n):                                #<---- most efficient method to calculate no. of factors of number             
    hh = [1] * (n + 1); 
    p = 2; 
    while((p * p) < n): 
        if (hh[p] == 1): 
            for i in range((p * 2), n, p): 
                hh[i] = 0; 
        p += 1;  
    total = 1; 
    for p in range(2, n + 1): 
        if (hh[p] == 1):  
            count = 0; 
            if (n % p == 0): 
                while (n % p == 0): 
                    n = int(n / p); 
                    count += 1; 
                total *= (count + 1); 
    return total;

def prime_factors(n):                                         #<------------ to find prime factors of a no.
    i = 2
    factors = set()
    while i * i <= n:
        if n % i:
            i += 1
        else:
            factors.add(n//i)
            n=n//i
            factors.add(i)
        
    if n > 1:
        factors.add(n)
    return (factors)

def isPrime(n):                                                      #<-----------check whether a no. is prime or not
    if n==2 or n==3: return True
    if n%2==0 or n<2: return False
    for i in range(3,int(n**0.5)+1,2):   # only odd numbers
        if n%i==0:
            return False    

    return True
def solve(n):
    if n==1:
        return (1)
    p=2
    while (p*p)<=n:
        if n%p==0:
            return (n//p)
        p=p+1
    return False
def expo(x,n):
    result=1
    while n>1:
        if n&1:
            n=n-1
            result=result*x
        else:
            n=n//2
            x=x*x
    return (result*x)
    

def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()
# ///==========MAIN=============///
n=int(input())
Arr=get_array()
A=[];B=[];C=[]
for i in Arr:
    if i<0:
        A.append(i)
    elif i>0:
        B.append(i)
    else:
        C.append(i)
if not len(A)&1:
    C.append(A[-1])
    del A[-1]
if len(B)==0:
    B.append(A[-1])
    B.append(A[-2])
    del A[-1];del A[-1]
print(len(A),*A,sep=' ')
print(len(B),*B,sep=' ')
print(len(C),*C,sep=' ')