import java.util.*;
import java.lang.*;
import java.io.*;
 
class Ideone
{
  public static void main (String[] args) throws java.lang.Exception
  {
	int x;
	Vector Odd = new Vector();
	Vector Even = new Vector();
	Scanner in = new Scanner(System.in);
	
	while(true) 
	{
		try{
			x = in.nextInt();
			
    			if(x%2==0) Even.addElement(x);
    			else Odd.addElement(x);
		}
		catch (Exception obj)
		{
			
    			break;
		}
	}
	for(int i=0;i<Even.size();i++)
	{
		System.out.print(Even.get(i) + " ");
	}
            System.out.print("\n");
	for(int i=0;i<Odd.size();i++)
	{
		System.out.print(Odd.get(i) + " ");
	}	
  }
}