← Home
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var n int
	if _, err := fmt.Fscan(in, &n); err != nil {
		return
	}

	next := make([]int, 26)
	prev := make([]int, 26)
	for i := 0; i < 26; i++ {
		next[i] = -1
		prev[i] = -1
	}
	present := make([]bool, 26)
	ok := true

	for i := 0; i < n; i++ {
		var s string
		fmt.Fscan(in, &s)
		seen := make([]bool, 26)
		for j := 0; j < len(s); j++ {
			c := int(s[j] - 'a')
			if seen[c] {
				ok = false
			}
			seen[c] = true
			present[c] = true
		}
		for j := 0; j+1 < len(s); j++ {
			a := int(s[j] - 'a')
			b := int(s[j+1] - 'a')
			if next[a] != -1 && next[a] != b {
				ok = false
			}
			if prev[b] != -1 && prev[b] != a {
				ok = false
			}
			next[a] = b
			prev[b] = a
		}
	}

	if !ok {
		
		
		return
	}

	visited := make([]bool, 26)
	res := make([]byte, 0, 26)

	for i := 0; i < 26; i++ {
		if present[i] && prev[i] == -1 {
			cur := i
			for cur != -1 {
				if visited[cur] {
					ok = false
					break
				}
				visited[cur] = true
				res = append(res, byte('a'+cur))
				cur = next[cur]
			}
			if !ok {
				return
			}
		}
	}

	for i := 0; i < 26; i++ {
		if present[i] && !visited[i] {
			
			cur := i
			seen := make(map[int]bool)
			for prev[cur] != -1 && !seen[cur] {
				seen[cur] = true
				cur = prev[cur]
			}
			if prev[cur] != -1 {
				
				return
			}
			for cur != -1 {
				if visited[cur] {
					break
				}
				visited[cur] = true
				res = append(res, byte('a'+cur))
				cur = next[cur]
			}
		}
	}

	fmt.Fprintln(out, string(res))
}