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
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int> tp;
// typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
/*
signed main(){
	int n,m;
	cin>>n>>m;
	int w=sqrt(n)+10;
	vi dp(n+1);
	rep(i,m){
		cin>>a>>b;
		if(b>w){
			if(a!=b-1){
				dp[0]+=a+1;
				dp[1]-=a;
				for(int j=b-a-1;j<n;j+=b){
					dp[j]-=b;
					if(j+1<=n)dp[j+1]+=b;
				}
			}else{
				dp[1]+=1;
				dp[]+=;
			}
		}else{
			
		}
	}
	rep(i,n)dp[i+1]+=dp[i];
	rep(i,n)dp[i+1]+=dp[i];
	rep(i,n){
		int sum=dp[i];
		rep(j,w)sum+=d[j][i%j];
		cout<<sum<<endl;
	}
}
*/


struct edge{int to,cap,rev;};//ikisaki youryou gyakuhen
class MF{//max flow
	public:
	int n;
	vector<vector<edge> >G;//[MAX];
	vi level,iter;//[MAX];
	MF(int size){
		n=size;
		G=vector<vector<edge> >(n);
	}
	void add_edge(int from, int to, int cap){
		edge q={to,cap,int(G[to].size())};
		G[from].push_back(q);
		q={from,0,int(G[from].size()-1)};
		G[to].push_back(q);
	}
	void bfs(int s){
		level=vi(n,-1);
		queue<int>q;
		level[s]=0;
		q.push(s);
		while(!q.empty()){
			int v=q.front();q.pop();
			for(int i=0;i<G[v].size();i++){
				edge &e=G[v][i];
				if(e.cap>0&&level[e.to]<0){
					level[e.to]=level[v]+1;
					q.push(e.to);
				}
			}
		}
	}
	int dfs(int v,int t, int f) {
		if(v==t)return f;
		for(int &i=iter[v];i<G[v].size();i++){
			edge &e=G[v][i];
			if(level[v]>=level[e.to]||e.cap<=0) continue;
			int d =dfs(e.to,t,min(f,e.cap));
			if(d>0){
				e.cap-=d;
				G[e.to][e.rev].cap+=d;
				return d;
			}
		}
		return 0;
	}
	int mf(int s,int t) {//from s to t,ford_fulkerson
		int flow=0;
		while(1){
			bfs(s);
			if(level[t]<0)return flow;
			iter=vi(n);
			int f;
			while((f=dfs(s,t,inf))>0)flow+=f;
		}
	}
};
int main(){
	int n;
	cin>>n;
	vs in(n);
	rep(i,n)cin>>in[i];
	vvi co(26,vi(26));
	vi h(26);
	rep(i,n){
		string s=in[i];
		h[s[s.size()-1]-'a']=1;
		co[s[0]-'a'][s[s.size()-1]-'a']++;
	}

/*	vvi fl(26,vi(26));
	rep(i,26)rep(j,26)if(i!=j){
		MF mf(26);
		rep(x,26)rep(y,26)if(x!=y)
			mf.add_edge(x,y,co[x][y]);
		fl[i][j]=mf.mf(i,j);
	}
	*/
	rep(i,26)if(h[i]){
		int sum=0;
		MF mf(27);
		rep(j,26)rep(k,26)if(j!=i&&j!=k&&i!=k&&co[j][k]){
			mf.add_edge(j,k,co[j][k]);
		}
		rep(j,26){
			if(co[i][j])mf.add_edge(i,j,co[i][j]);
			if(co[j][i])mf.add_edge(j,26,co[j][i]);
			sum+=co[i][j];
		}
		int flow=mf.mf(i,26);
		if(flow==sum)cout<<(char)('a'+i)<<endl;
	}
}







