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

Solution:
#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  return (b != 0 ? gcd(b, a % b) : a);
}
template <typename T>
T modulo_cross(T a) {
  return (a % 1000000007 * (a + 1) % 1000000007) % 1000000007;
}
template <typename T>
T lcm(T a, T b) {
  return (a / gcd(a, b) * b);
}
template <typename T>
T BigMod(T b, T p, T m) {
  if (p == 0) return 1;
  if (p % 2 == 0) {
    long long s = BigMod(b, p / 2, m) % m;
    return (s * s) % m;
  }
  long long sm = ((b % m) * (BigMod(b, p - 1, m) % m)) % m;
  return sm;
}
template <typename T>
T ModInv(T b, T m) {
  return BigMod(b, m - 2, m);
}
template <typename T>
T POW(T B, T P) {
  if (P == 0) return 1;
  if (P & 1)
    return B * POW(B, P - 1);
  else
    return (POW(B, P / 2) * POW(B, P / 2));
}
template <typename T>
T Swap(T &a, T &b) {
  T tmp = a;
  a = b;
  b = tmp;
}
int Set(int N, int pos) { return N = N | (1 << pos); }
int Reset(int N, int pos) { return N = N & ~(1 << pos); }
bool Check(int N, int pos) { return (bool)(N & (1 << pos)); }
double DEG(double x) { return (180.0 * x) / (2.0 * acos(0.0)); }
double RAD(double x) { return (x * (double)2.0 * acos(0.0)) / (180.0); }
int toInt(string s) {
  int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
template <class T>
inline bool readfast(T &x) {
  int c = getchar();
  int sgn = 1;
  while (~c && c < '0' || c > '9') {
    if (c == '-') sgn = -1;
    c = getchar();
  }
  for (x = 0; ~c && '0' <= c && c <= '9'; c = getchar()) x = x * 10 + c - '0';
  x *= sgn;
  return ~c;
}
int R[] = {0, 0, -1, 1, 1, -1, -1, 1};
int C[] = {1, -1, 0, 0, 1, -1, 1, -1};
int KR[] = {-2, -2, -1, 1, 2, 2, -1, 1};
int KC[] = {1, -1, 2, 2, 1, -1, -2, -2};
struct P {
  double x, y;
  P(double x = 0.0, double y = 0.0) {
    this->x = x;
    this->y = y;
  }
};
P mkv(P ae, P be) { return P(be.x - ae.x, be.y - ae.y); }
double dtp(P ae, P be) { return (ae.x * be.x + ae.y * be.y); }
double crp(P ae, P be) { return (ae.x * be.y - ae.y * be.x); }
double val(P ae) { return sqrt(dtp(ae, ae)); }
P vresize(P ae, double llen) {
  double v = val(ae);
  return P(ae.x * llen / v, ae.y * llen / v);
}
double ART(P ae, P be) { return crp(ae, be) / 2.0; }
P rot(P ae, double ang) {
  return P(ae.x * cos(ang) - ae.y * sin(ang),
           ae.y * cos(ang) + ae.x * sin(ang));
}
struct st {
  long long a, b, c, idx;
  st(long long a, long long b, long long c, long long idx) {
    this->a = a;
    this->b = b;
    this->c = c;
    this->idx = idx;
  }
};
vector<st> V;
bool cmp(st a, st b) {
  if (a.a == b.a) {
    if (a.b == b.b)
      return a.c < b.c;
    else
      return a.b < b.b;
  } else
    return a.a < b.a;
}
int main() {
  int n, x, i, temp;
  vector<int> a, b, c;
  a.clear();
  b.clear();
  c.clear();
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &x);
    if (x < 0)
      a.push_back(x);
    else if (x)
      b.push_back(x);
    else
      c.push_back(x);
  }
  if (b.size() == 0) {
    temp = *(a.end() - 1);
    b.push_back(temp);
    a.pop_back();
    temp = *(a.end() - 1);
    b.push_back(temp);
    a.pop_back();
  }
  if (a.size() % 2 == 0) {
    temp = *(a.end() - 1);
    c.push_back(temp);
    a.pop_back();
  }
  cout << a.size();
  for (auto x : a) cout << " " << x;
  cout << endl;
  cout << b.size();
  for (auto x : b) cout << " " << x;
  cout << endl;
  cout << c.size();
  for (auto x : c) cout << " " << x;
  cout << endl;
  return 0;
}