#!/usr/bin/python3
import string

def solve():
    n = int(input())
    words = [input() for __ in range(n)]
    lets = set()
    for word in words:
        for c in word:
            lets.add(c)
    m = 18
    for c in string.ascii_lowercase:
        if len(lets) < m:
            lets.add(c)

    lets = sorted(list(lets))
    if len(lets) > m:
        print(0)
        return

    graph = [[True for _ in range(m)] for __ in range(m)]
    for i in range(m):
        for j in range(m):
            if i == j:
                if any(w.count(lets[i]) >= 2 for w in words):
                    graph[i][j] = False
            else:
                if any(lets[i] in w and lets[j] in w for w in words):
                    graph[i][j] = False


    valid = set()
    for a1 in range(m):
        for a2 in range(a1+1,m):
            for a3 in range(a2+1,m):
                for a4 in range(a3+1,m):
                    for a5 in range(a4+1,m):
                        for a6 in range(a5+1,m):
                            aa = [a1,a2,a3,a4,a5,a6]
                            if all(graph[i][j] for i in aa for j in aa):
                                v = 0
                                for a in aa:
                                    v |= 1 << a
                                valid.add(v)

    def f(mask):
        s = ""
        for i in range(m):
            if (mask>>i)&1 == 1:
                s += lets[i]
        return s

    for i in valid:
        for j in valid:
            if i&j == 0 and ((1<<m)-1)^i^j in valid:
                print(f(i),f(j),f(((1<<m)-1)^i^j))
                return
    print(0)

solve()

