P10494 [AOJ] Shiritori
普及
题目描述

Problem

Here is a list of strings. Let's take a break and play with shiritori. Shiritori is performed according to the following rules.

  1. First of all, select one of your favorite strings from the list and exclude that string from the list.
  2. Next, select one character string from the list in which the last character of the previously selected character string is the first character.
  3. Exclude the selected string from the list.

After this, steps 2 and 3 will be repeated alternately.

Now, let's assume that this shiritori is continued until there are no more strings to select from the list in 2. At this time, I want to list all the characters that can be the "last character" of the last selected character string.

Constraints

The input satisfies the following conditions.

  • $1 \ le N \ lt 10 ^ 4$
  • $1 \ le | s_i | \ lt 100$
  • $s_i \ neq s_j (i \ neq j)$
  • The string contains only lowercase letters

Input

$ N $
$ s_1 $
$ s_2 $
$ s_3 $
::
$ s_N $

The number of strings $ N $ is given on the first line.
The following $ N $ line is given a list of strings.

Output

Output the characters that can be the "last character" of the last selected character string in ascending order from a to z in lexicographical order.

Examples

Input

5
you
ate
my
hum
toast

Output

e
t
u

Input

7
she
sells
sea
shells
by
the
seashore

Output

a
e
y

输入格式

见题面

输出格式

见题面

样例输入
5 you ate my hum toast
样例输出
e t u