#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> numbers;
  int cantidadNegativos = 0;
  for (int i = 0; i < n; i++) {
    int aux;
    cin >> aux;
    if (aux < 0) cantidadNegativos++;
    numbers.push_back(aux);
  }
  sort(numbers.begin(), numbers.end());
  auto aux = lower_bound(numbers.begin(), numbers.end(), 0);
  int indice0 = aux - numbers.begin();
  vector<int> productoPositivo;
  cout << "1 " << numbers[0] << '\n';
  if (cantidadNegativos % 2 == 0) {
    cout << n - 3 << " ";
    for (int i = 1; i < indice0 - 1; i++) {
      cout << numbers[i] << " ";
    }
    for (int i = indice0 + 1; i < n; i++) {
      cout << numbers[i] << " ";
    }
    cout << "2 " << numbers[indice0 - 1] << " " << numbers[indice0];
  } else {
    cout << n - 2 << " ";
    for (int i = 1; i < indice0; i++) {
      cout << numbers[i] << " ";
    }
    for (int i = indice0 + 1; i < n; i++) {
      cout << numbers[i] << " ";
    }
    cout << "\n1 0";
  }
  return 0;
}
