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.io.File;import java.io.FileInputStream;import java.io.FileNotFoundException;
import java.io.IOException;import java.io.InputStream;import java.io.PrintStream;
import java.io.PrintWriter;import java.security.AccessControlException;import java.util.ArrayList;
import java.util.Arrays;import java.util.Collection;import java.util.Comparator;
import java.util.List;import java.util.Map;import java.util.Objects;import java.util.TreeMap;
import java.util.function.Function;import java.util.stream.Collectors;import java.util.stream.IntStream;
import java.util.stream.LongStream;import java.util.stream.Stream;public class _p000300A {
static public void main(final String[] args) throws IOException{p000300A._main(args);}

static private class p000300A extends Solver{public p000300A(){singleTest=true;}
@Override public void solve()throws IOException{int n=sc.nextInt();sc.nextLine();
int[]a=lineToIntArray();ArrayList<Integer>pos=new ArrayList<>();ArrayList<Integer>
neg=new ArrayList<>();int num_zeros=0;for(int i=0;i<n;i++){if(a[i]<0){neg.add(a[i]);
}else if(a[i]>0){pos.add(a[i]);}else{num_zeros++;}}pw.print(1+" ");pw.println(neg.get(0));
neg.remove((int)0);if(pos.size()>0){pw.print(1+" ");pw.println(pos.get(0));pos.remove((int)
0);}else{pw.print(2+" ");pw.println(neg.get(0)+" "+neg.get(1));neg.remove((int)0);
neg.remove((int)0);}pw.print((num_zeros+neg.size()+pos.size())+" ");pw.println(join(IntStream.range(0,
num_zeros).mapToObj(i->"0"))+" "+join(neg)+" "+join(pos));}static public void _main(String[]
args)throws IOException{new p000300A().run();}}static private class MyScanner{private 
StringBuilder cache=new StringBuilder();int cache_pos=0;private int first_linebreak
=-1;private int second_linebreak=-1;private StringBuilder sb=new StringBuilder();
private InputStream is=null;public MyScanner(final InputStream is){this.is=is;}private 
String charToString(final int c){return String.format("'%s'",c=='\n'?"\\n":(c=='\r'
?"\\r":String.valueOf((char)c)));}public int get(){int res=-1;if(cache_pos<cache.length())
{res=cache.charAt(cache_pos);cache_pos++;if(cache_pos==cache.length()){cache.delete(0,
cache_pos);cache_pos=0;}}else{try{res=is.read();}catch(IOException ex){throw new 
RuntimeException(ex);}}return res;}private void unget(final int c){if(cache_pos==
0){cache.insert(0,(char)c);}else{cache_pos--;}}public String nextLine(){sb.delete(0,
sb.length());int c;boolean done=false;boolean end=false;while((c=get())!=-1){if(check_linebreak(c))
{done=true;if(c==first_linebreak){if(!end){end=true;}else{cache.append((char)c);
break;}}else if(second_linebreak!=-1 && c==second_linebreak){break;}}if(end && c
!=first_linebreak && c!=second_linebreak){cache.append((char)c);break;}if(!done)
{sb.append((char)c);}}return sb.toString();}private boolean check_linebreak(int 
c){if(c=='\n'|| c=='\r'){if(first_linebreak==-1){first_linebreak=c;}else if(c!=first_linebreak 
&& second_linebreak==-1){second_linebreak=c;}return true;}return false;}public int 
nextInt(){int sign=0;boolean done=false;boolean started=false;int res=0;int c;while((c
=get())!=-1){check_linebreak(c);if(sign==0 && c=='-'){started=true;sign=-1;}else 
if(c>='0'&& c<='9'){if(sign==0){sign=1;}started=true;res*=10;res+=c-'0';done=true;
}else if(!done){if(started){unget(c);if(sign==-1){unget('-');}break;}}else{unget(c);
break;}}if(done){return res*sign;}throw new RuntimeException();}public long nextLong()
{int sign=0;boolean done=false;boolean started=false;long res=0;int c;while((c=get())
!=-1){check_linebreak(c);if(sign==0 && c=='-'){started=true;sign=-1;}else if(c>=
'0'&& c<='9'){if(sign==0){sign=1;}started=true;res*=10;res+=c-'0';done=true;}else 
if(!done){if(started){unget(c);if(sign==-1){unget('-');}break;}}else{unget(c);break;
}}if(done){return res*sign;}throw new RuntimeException();}public boolean hasNext()
{boolean res=false;int c;while((c=get())!=-1){if(!check_linebreak(c)&& c!=' '&& 
c!='\t'){res=true;unget(c);break;}}return res;}public String next(){sb.delete(0,
sb.length());boolean started=false;int c;while((c=get())!=-1){if(check_linebreak(c)
|| c==' '|| c=='\t'){if(started){unget(c);break;}}else{started=true;sb.append((char)c);
}}return sb.toString();}public int nextChar(){return get();}public boolean eof()
{int c=get();boolean res=false;if(c!=-1){unget(c);}else{res=true;}return res;}}static private class 
Pair<K,V>{private K k;private V v;public Pair(final K t,final V u){this.k=t;this.v
=u;}public K getKey(){return k;}public V getValue(){return v;}}static private abstract class 
Solver{protected String nameIn=null;protected String nameOut=null;protected boolean 
singleTest=false;protected boolean preprocessDebug=false;protected boolean doNotPreprocess
=false;protected PrintStream debugPrintStream=null;protected MyScanner sc=null;protected 
PrintWriter pw=null;final static String SPACE=" ";final static String SPACES="\\s+";
private int current_test=0;private int count_tests=0;protected int currentTest()
{return current_test;}protected int countTests(){return count_tests;}private void 
process()throws IOException{if(!singleTest){count_tests=lineToIntArray()[0];for(current_test
=1;current_test<=count_tests;current_test++){solve();pw.flush();}}else{count_tests
=1;current_test=1;solve();pw.flush();}}abstract protected void solve()throws IOException;
protected String[]lineToArray()throws IOException{return sc.nextLine().trim().split(SPACES);
}protected int[]lineToCharArray()throws IOException{return sc.nextLine().chars().toArray();
}protected int[]lineToIntArray()throws IOException{return Arrays.stream(lineToArray()).mapToInt(Integer::valueOf).toArray();
}protected long[]lineToLongArray()throws IOException{return Arrays.stream(lineToArray()).mapToLong(Long::valueOf).toArray();
}protected void run()throws IOException{boolean done=false;try{if(nameIn!=null && 
new File(nameIn).exists()){try(FileInputStream fis=new FileInputStream(nameIn);PrintWriter 
pw0=select_output();){done=true;sc=new MyScanner(fis);pw=pw0;process();}}}catch(IOException 
ex){}catch(AccessControlException ex){}if(!done){try(PrintWriter pw0=select_output();
){sc=new MyScanner(System.in);pw=pw0;process();}}}private PrintWriter select_output()
throws FileNotFoundException{if(nameOut!=null){return new PrintWriter(nameOut);}
return new PrintWriter(System.out);}public static Map<Integer,List<Integer>>mapi(final 
int[]a){return IntStream.range(0,a.length).collect(()->new TreeMap<Integer,List<Integer>>(),
(res,i)->{if(!res.containsKey(a[i])){res.put(a[i],Stream.of(i).collect(Collectors.toList()));
}else{res.get(a[i]).add(i);}},Map::putAll);}public static Map<Long,List<Integer>>
mapi(final long[]a){return IntStream.range(0,a.length).collect(()->new TreeMap<Long,
List<Integer>>(),(res,i)->{if(!res.containsKey(a[i])){res.put(a[i],Stream.of(i).collect(Collectors.toList()));
}else{res.get(a[i]).add(i);}},Map::putAll);}public static<T>Map<T,List<Integer>>
mapi(final T[]a){return IntStream.range(0,a.length).collect(()->new TreeMap<T,List<Integer>>(),
(res,i)->{if(!res.containsKey(a[i])){res.put(a[i],Stream.of(i).collect(Collectors.toList()));
}else{res.get(a[i]).add(i);}},Map::putAll);}public static<T>Map<T,List<Integer>>
mapi(final T[]a,Comparator<T>cmp){return IntStream.range(0,a.length).collect(()->
new TreeMap<T,List<Integer>>(cmp),(res,i)->{if(!res.containsKey(a[i])){res.put(a[i],
Stream.of(i).collect(Collectors.toList()));}else{res.get(a[i]).add(i);}},Map::putAll
);}public static Map<Integer,List<Integer>>mapi(final IntStream a){int[]i=new int[]{0};
return a.collect(()->new TreeMap<Integer,List<Integer>>(),(res,v)->{if(!res.containsKey(v))
{res.put(v,Stream.of(i[0]).collect(Collectors.toList()));}else{res.get(v).add(i[0]);
}i[0]++;},Map::putAll);}public static Map<Long,List<Integer>>mapi(final LongStream 
a){int[]i=new int[]{0};return a.collect(()->new TreeMap<Long,List<Integer>>(),(res,
v)->{if(!res.containsKey(v)){res.put(v,Stream.of(i[0]).collect(Collectors.toList()));
}else{res.get(v).add(i[0]);}i[0]++;},Map::putAll);}public static<T>Map<T,List<Integer>>
mapi(final Stream<T>a,Comparator<T>cmp){int[]i=new int[]{0};return a.collect(()->
new TreeMap<T,List<Integer>>(cmp),(res,v)->{if(!res.containsKey(v)){res.put(v,Stream.of(i[0]).collect(Collectors.toList()));
}else{res.get(v).add(i[0]);}},Map::putAll);}public static<T>Map<T,List<Integer>>
mapi(final Stream<T>a){int[]i=new int[]{0};return a.collect(()->new TreeMap<T,List<Integer>>(),
(res,v)->{if(!res.containsKey(v)){res.put(v,Stream.of(i[0]).collect(Collectors.toList()));
}else{res.get(v).add(i[0]);}},Map::putAll);}public static List<int[]>listi(final 
int[]a){return IntStream.range(0,a.length).mapToObj(i->new int[]{a[i],i}).collect(Collectors.toList());
}public static List<long[]>listi(final long[]a){return IntStream.range(0,a.length).mapToObj(i
->new long[]{a[i],i}).collect(Collectors.toList());}public static<T>List<Pair<T,
Integer>>listi(final T[]a){return IntStream.range(0,a.length).mapToObj(i->new Pair<T,
Integer>(a[i],i)).collect(Collectors.toList());}public static List<int[]>listi(final 
IntStream a){int[]i=new int[]{0};return a.mapToObj(v->new int[]{v,i[0]++}).collect(Collectors.toList());
}public static List<long[]>listi(final LongStream a){int[]i=new int[]{0};return 
a.mapToObj(v->new long[]{v,i[0]++}).collect(Collectors.toList());}public static<T>
List<Pair<T,Integer>>listi(final Stream<T>a){int[]i=new int[]{0};return a.map(v->
new Pair<T,Integer>(v,i[0]++)).collect(Collectors.toList());}public static<T>List<Pair<T,
Integer>>listi(final Collection<T>a){int[]i=new int[]{0};return a.stream().map(v
->new Pair<T,Integer>(v,i[0]++)).collect(Collectors.toList());}public static String 
join(final int[]a){return Arrays.stream(a).mapToObj(Integer::toString).collect(Collectors.joining(SPACE));
}public static String join(final long[]a){return Arrays.stream(a).mapToObj(Long::toString).collect(Collectors.joining(SPACE));
}public static<T>String join(final T[]a){return Arrays.stream(a).map(v->Objects.toString(v)).collect(Collectors.joining(SPACE));
}public static<T>String join(final T[]a,final Function<T,String>toString){return 
Arrays.stream(a).map(v->toString.apply(v)).collect(Collectors.joining(SPACE));}public 
static<T>String join(final Collection<T>a){return a.stream().map(v->Objects.toString(v)).collect(Collectors.joining(SPACE));
}public static<T>String join(final Collection<T>a,final Function<T,String>toString)
{return a.stream().map(v->toString.apply(v)).collect(Collectors.joining(SPACE));
}public static<T>String join(final Stream<T>a){return a.map(v->Objects.toString(v)).collect(Collectors.joining(SPACE));
}public static<T>String join(final Stream<T>a,final Function<T,String>toString){
return a.map(v->toString.apply(v)).collect(Collectors.joining(SPACE));}public static
<T>String join(final IntStream a){return a.mapToObj(Integer::toString).collect(Collectors.joining(SPACE));
}public static<T>String join(final LongStream a){return a.mapToObj(Long::toString).collect(Collectors.joining(SPACE));
}public static List<Integer>list(final int[]a){return Arrays.stream(a).mapToObj(Integer::valueOf).collect(Collectors.toList());
}public static List<Integer>list(final IntStream a){return a.mapToObj(Integer::valueOf).collect(Collectors.toList());
}public static List<Long>list(final long[]a){return Arrays.stream(a).mapToObj(Long::valueOf).collect(Collectors.toList());
}public static List<Long>list(final LongStream a){return a.mapToObj(Long::valueOf).collect(Collectors.toList());
}public static<T>List<T>list(final Stream<T>a){return a.collect(Collectors.toList());
}public static<T>List<T>list(final Collection<T>a){return a.stream().collect(Collectors.toList());
}public static<T>List<T>list(final T[]a){return Arrays.stream(a).collect(Collectors.toList());
}public static String yesNo(final boolean res){return res?"YES":"NO";}}}