#include <iostream>

using namespace std;

int main()
{
  int n;
  int i=0;
  int x;
  cin >> n;
  int a[n];
  int z[n];
  int f[n];
  while (i < n)
  {
    cin >> a[i];
    i++;
  }
  i = 0;
  x=0;
  int y=0;
  while (i < n)
  {
    if (a[i] % 2 == 0)
    {
      z[x] = a[i];
      x++;
    }
    else 
    {
      f[y] = a[i];
      y++;
    }  
    i++;
  }
  i = 0;
  cout << x <<" ";
  while (i < x)
  {
    cout << z[i]<<" ";
    i++;
  }    
  cout << "\n";
  i = 0;
  cout << y <<" ";
  while (i < y)
  {
    cout << f[i] <<" ";
    i++;
  }    

  return 0;
}