P = 1000
alph = (?A..?Z).to_a + (?a..?z).to_a
code = Hash[*alph.zip((0..alph.size-1).to_a).flatten]

n = gets.to_i
a = $<.map {|l| l.chomp.split("")}
edges = {}
(1..n).each do |i|
    edges[[0, i]] = 0
    (1..n).each do |j|
        edges[[i, n+j]] = P ** code[a[i-1][j-1]]
    end
    edges[[n+i, 2*n+1]] = 0
end

n.times do
    dist = [Float::INFINITY] * (2*n+2)
    dist[0] = 0
    prev_node = [nil] * (2*n+2)
    (2*n+1).times do
        edges.each do |(i, j), len|
            d = dist[i] + len
            if d < dist[j]
                dist[j] = d
                prev_node[j] = i
            end
        end
    end
    path = [2*n+1]
    path << prev_node[path[-1]] while prev_node[path[-1]]
    path.each_cons(2) do |i, j|
        c = edges[[j, i]]
        edges.delete([j, i])
        edges[[i, j]] = -c
    end
end

puts edges.keys.select {|i, j| i > j && j != 0 && i != 2*n+1}.map {|j, i| a[i-1][j-n-1]}.sort.join