#D11591. Shiritori
Shiritori
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.
- First of all, select one of your favorite strings from the list and exclude that string from the list.
- Next, select one character string from the list in which the last character of the previously selected character string is the first character.
- 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.
- The string contains only lowercase letters
Input
::
The number of strings is given on the first line. The following 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
inputFormat
input satisfies the following conditions.
- The string contains only lowercase letters
Input
::
The number of strings is given on the first line. The following line is given a list of strings.
outputFormat
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
</p>