#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[100], b[100], i, n, x = 0, c0 = 0, c = 0, g, m, cn = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> m;
    if (m == 0)
      c0++;
    else if (x == 0 && m < 0) {
      g = m;
      x = 1;
    } else if (x == 1 && m < 0) {
      b[cn] = m;
      cn++;
    } else {
      a[c] = m;
      c++;
    }
  }
  cout << 1 << " " << g << "\n";
  if (cn % 2 == 1) {
    cout << c + cn - 1 << " ";
    for (i = 0; i < c; i++) cout << a[i] << " ";
    for (i = 0; i < cn - 1; i++) cout << b[i] << " ";
    cout << "\n";
    cout << ++c0 << " " << b[cn - 1] << " ";
    for (i = 0; i < c0 - 1; i++) cout << 0 << " ";
  }
  if (cn % 2 == 0) {
    cout << c + cn << " ";
    for (i = 0; i < c; i++) cout << a[i] << " ";
    for (i = 0; i < cn; i++) cout << b[i] << " ";
    cout << "\n" << c0 << " ";
    for (i = 0; i < c0; i++) cout << 0 << " ";
  }
}
