import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;

void main()
{
	int[10] wSum, kSum;
	foreach (i; 0..10) {
		wSum[i] = readln.chomp.to!int;
	}
	foreach (i; 0..10) {
		kSum[i] = readln.chomp.to!int;
	}

	writeln(wSum.array.sort!("a > b")[0..3].reduce!("a+b"), " ", kSum.array.sort!("a > b")[0..3].reduce!("a+b"));
}