#include using namespace std; int main() { int N; cin >> N; vector S(N); vector l,r; char mx = 'a',res = 0; for(int i = 0; i < N; i++) { cin >> S[i]; string T = S[i]; sort(T.begin(),T.end()); if(S[i] == T) { l.push_back(S[i][0]); r.push_back(S[i].back()); if(mx == S[i][0]) { res++; } if(mx < S[i][0]) { mx = S[i][0]; res = 1; } } } bool flag = false; for(int i = 0; i < l.size(); i++) { if(r[i] < mx) { flag = true; } if(l[i] == r[i] && r[i] == mx && res >= 2) { flag = true; } } cout << ((flag)?"Yes":"No") << endl; }