n = gets.to_i
buckets = (0..5).map{ [] }
$<.each{|s|
	s.chomp!
	buckets[s.size] << s
}

buckets.shift while buckets[0].empty?

a = buckets.shift.sort
if a.size >= 3
	puts a[0..3].combination(2).map{|s1, s2|
		[s1 + s2, s2 + s1]
	}.flatten.sort[2]
else
	buckets.shift while buckets[0].empty?
	b = buckets[0].sort
	if a.size == 2
		puts [a[0] + b[0], b[0] + a[0]].min
	else #a.size == 1
		if b.size >= 2
			puts b[0..[2, b.size-1].min].map{|x|
				[a[0] + x, x + a[0]]
			}.flatten.sort[2]
		else #b.size == 1
			buckets.shift while buckets[0].empty?
			c = buckets[0].sort
			puts [a[0] + c[0], c[0] + a[0]].min
		end
	end
end