import java.util.*; public class P1098 { public static void main(String[] args) { Scanner in = new Scanner(System.in); List a = new ArrayList<>(); while (in.hasNextInt()) a.add(in.nextInt()); StringBuilder first = new StringBuilder(); StringBuilder second = new StringBuilder(); boolean f = true; for (int i = 0; i < a.size(); i++) { if ((i & 1) == 0) { if (!f) first.append(' '); first.append(a.get(i)); f = false; } else { if (second.length() > 0) second.append(' '); second.append(a.get(i)); } } System.out.println(first.toString()); System.out.println(second.toString()); in.close(); } }