import java.util.*;
class Main {
    public static void main(String args[]) {
        Scanner s = new Scanner(System.in);
        int n = Integer.parseInt(s.nextLine());
        String prevWord = null;
        String currWord = null;
        Set<String> set = new HashSet<>();
        boolean isValid = true;
        for(int i = 0; i< n ;i++) {
            currWord = s.nextLine();
            if(set.contains(currWord)) {
                isValid = false;
            }
            set.add(currWord);
            if( isValid && i != 0 ) {
                if(prevWord.charAt(prevWord.length() - 1) != currWord.charAt(0)) {
                    isValid = false;
                }
            }
            prevWord = currWord;
        }
        System.out.println(isValid ? "Yes" : "No");
    }
} import java.util.*; util.* java class Main {
    public static void main(String args[]) {
        Scanner s = new Scanner(System.in);
        int n = Integer.parseInt(s.nextLine());
        String prevWord = null;
        String currWord = null;
        Set<String> set = new HashSet<>();
        boolean isValid = true;
        for(int i = 0; i< n ;i++) {
            currWord = s.nextLine();
            if(set.contains(currWord)) {
                isValid = false;
            }
            set.add(currWord);
            if( isValid && i != 0 ) {
                if(prevWord.charAt(prevWord.length() - 1) != currWord.charAt(0)) {
                    isValid = false;
                }
            }
            prevWord = currWord;
        }
        System.out.println(isValid ? "Yes" : "No");
    }
} Main public static void main(String args[]) {
        Scanner s = new Scanner(System.in);
        int n = Integer.parseInt(s.nextLine());
        String prevWord = null;
        String currWord = null;
        Set<String> set = new HashSet<>();
        boolean isValid = true;
        for(int i = 0; i< n ;i++) {
            currWord = s.nextLine();
            if(set.contains(currWord)) {
                isValid = false;
            }
            set.add(currWord);
            if( isValid && i != 0 ) {
                if(prevWord.charAt(prevWord.length() - 1) != currWord.charAt(0)) {
                    isValid = false;
                }
            }
            prevWord = currWord;
        }
        System.out.println(isValid ? "Yes" : "No");
    } main {
        Scanner s = new Scanner(System.in);
        int n = Integer.parseInt(s.nextLine());
        String prevWord = null;
        String currWord = null;
        Set<String> set = new HashSet<>();
        boolean isValid = true;
        for(int i = 0; i< n ;i++) {
            currWord = s.nextLine();
            if(set.contains(currWord)) {
                isValid = false;
            }
            set.add(currWord);
            if( isValid && i != 0 ) {
                if(prevWord.charAt(prevWord.length() - 1) != currWord.charAt(0)) {
                    isValid = false;
                }
            }
            prevWord = currWord;
        }
        System.out.println(isValid ? "Yes" : "No");
    } Scanner s = new Scanner(System.in); s new Scanner(System.in) int n = Integer.parseInt(s.nextLine()); n Integer.parseInt(s.nextLine()) Integer.parseInt Integer s.nextLine() s.nextLine s String prevWord = null; prevWord null String currWord = null; currWord null Set<String> set = new HashSet<>(); set new HashSet<>() boolean isValid = true; isValid true for(int i = 0; i< n ;i++) {
            currWord = s.nextLine();
            if(set.contains(currWord)) {
                isValid = false;
            }
            set.add(currWord);
            if( isValid && i != 0 ) {
                if(prevWord.charAt(prevWord.length() - 1) != currWord.charAt(0)) {
                    isValid = false;
                }
            }
            prevWord = currWord;
        } int i = 0; int i = 0; i 0 i< n i n i++ i++ i {
            currWord = s.nextLine();
            if(set.contains(currWord)) {
                isValid = false;
            }
            set.add(currWord);
            if( isValid && i != 0 ) {
                if(prevWord.charAt(prevWord.length() - 1) != currWord.charAt(0)) {
                    isValid = false;
                }
            }
            prevWord = currWord;
        } {
            currWord = s.nextLine();
            if(set.contains(currWord)) {
                isValid = false;
            }
            set.add(currWord);
            if( isValid && i != 0 ) {
                if(prevWord.charAt(prevWord.length() - 1) != currWord.charAt(0)) {
                    isValid = false;
                }
            }
            prevWord = currWord;
        } currWord = s.nextLine() currWord s.nextLine() s.nextLine s if(set.contains(currWord)) {
                isValid = false;
            } set.contains(currWord) set.contains set currWord {
                isValid = false;
            } isValid = false isValid false set.add(currWord) set.add set currWord if( isValid && i != 0 ) {
                if(prevWord.charAt(prevWord.length() - 1) != currWord.charAt(0)) {
                    isValid = false;
                }
            } isValid && i != 0 isValid i != 0 i 0 {
                if(prevWord.charAt(prevWord.length() - 1) != currWord.charAt(0)) {
                    isValid = false;
                }
            } if(prevWord.charAt(prevWord.length() - 1) != currWord.charAt(0)) {
                    isValid = false;
                } prevWord.charAt(prevWord.length() - 1) != currWord.charAt(0) prevWord.charAt(prevWord.length() - 1) prevWord.charAt prevWord prevWord.length() - 1 prevWord.length() prevWord.length prevWord 1 currWord.charAt(0) currWord.charAt currWord 0 {
                    isValid = false;
                } isValid = false isValid false prevWord = currWord prevWord currWord System.out.println(isValid ? "Yes" : "No") System.out.println System.out System System.out isValid ? "Yes" : "No" isValid "Yes" "No" String args[] args
import java.util.*;
class Main {
    public static void main(String args[]) {
        Scanner s = new Scanner(System.in);
        int n = Integer.parseInt(s.nextLine());
        String prevWord = null;
        String currWord = null;
        Set<String> set = new HashSet<>();
        boolean isValid = true;
        for(int i = 0; i< n ;i++) {
            currWord = s.nextLine();
            if(set.contains(currWord)) {
                isValid = false;
            }
            set.add(currWord);
            if( isValid && i != 0 ) {
                if(prevWord.charAt(prevWord.length() - 1) != currWord.charAt(0)) {
                    isValid = false;
                }
            }
            prevWord = currWord;
        }
        System.out.println(isValid ? "Yes" : "No");
    }
}
