import javax.print.DocFlavor;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.function.BiConsumer;

public class Main {

    //グローバル変数を定義

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        String last = sc.next();
        boolean isInRule = true;
        ArrayList<String> already = new ArrayList<>();
        already.add(last);

        for(int i=1; i<n; i++){
            String input = sc.next();
            if(last.charAt(last.length()-1) != input.charAt(0)){
                isInRule = false;
                break;
            }
            if(already.contains(input)){
                isInRule = false;
            }
            already.add(input);
            last = input;
        }

        if(isInRule){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} import javax.print.DocFlavor; DocFlavor javax.print import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.math.BigDecimal; BigDecimal java.math import java.math.BigInteger; BigInteger java.math import java.nio.charset.StandardCharsets; StandardCharsets java.nio.charset import java.util.*; util.* java import java.util.function.BiConsumer; BiConsumer java.util.function public class Main {

    //グローバル変数を定義

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        String last = sc.next();
        boolean isInRule = true;
        ArrayList<String> already = new ArrayList<>();
        already.add(last);

        for(int i=1; i<n; i++){
            String input = sc.next();
            if(last.charAt(last.length()-1) != input.charAt(0)){
                isInRule = false;
                break;
            }
            if(already.contains(input)){
                isInRule = false;
            }
            already.add(input);
            last = input;
        }

        if(isInRule){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} Main public static void main(String[] args) throws IOException {
        new Main().run();
    } main {
        new Main().run();
    } new Main().run() new Main().run new Main() String[] args args void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        String last = sc.next();
        boolean isInRule = true;
        ArrayList<String> already = new ArrayList<>();
        already.add(last);

        for(int i=1; i<n; i++){
            String input = sc.next();
            if(last.charAt(last.length()-1) != input.charAt(0)){
                isInRule = false;
                break;
            }
            if(already.contains(input)){
                isInRule = false;
            }
            already.add(input);
            last = input;
        }

        if(isInRule){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } run {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        String last = sc.next();
        boolean isInRule = true;
        ArrayList<String> already = new ArrayList<>();
        already.add(last);

        for(int i=1; i<n; i++){
            String input = sc.next();
            if(last.charAt(last.length()-1) != input.charAt(0)){
                isInRule = false;
                break;
            }
            if(already.contains(input)){
                isInRule = false;
            }
            already.add(input);
            last = input;
        }

        if(isInRule){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc String last = sc.next(); last sc.next() sc.next sc boolean isInRule = true; isInRule true ArrayList<String> already = new ArrayList<>(); already new ArrayList<>() already.add(last) already.add already last for(int i=1; i<n; i++){
            String input = sc.next();
            if(last.charAt(last.length()-1) != input.charAt(0)){
                isInRule = false;
                break;
            }
            if(already.contains(input)){
                isInRule = false;
            }
            already.add(input);
            last = input;
        } int i=1; int i=1; i 1 i<n i n i++ i++ i {
            String input = sc.next();
            if(last.charAt(last.length()-1) != input.charAt(0)){
                isInRule = false;
                break;
            }
            if(already.contains(input)){
                isInRule = false;
            }
            already.add(input);
            last = input;
        } {
            String input = sc.next();
            if(last.charAt(last.length()-1) != input.charAt(0)){
                isInRule = false;
                break;
            }
            if(already.contains(input)){
                isInRule = false;
            }
            already.add(input);
            last = input;
        } String input = sc.next(); input sc.next() sc.next sc if(last.charAt(last.length()-1) != input.charAt(0)){
                isInRule = false;
                break;
            } last.charAt(last.length()-1) != input.charAt(0) last.charAt(last.length()-1) last.charAt last last.length()-1 last.length() last.length last 1 input.charAt(0) input.charAt input 0 {
                isInRule = false;
                break;
            } isInRule = false isInRule false break; if(already.contains(input)){
                isInRule = false;
            } already.contains(input) already.contains already input {
                isInRule = false;
            } isInRule = false isInRule false already.add(input) already.add already input last = input last input if(isInRule){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        } isInRule {
            System.out.println("Yes");
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
            System.out.println("No");
        } System.out.println("No") System.out.println System.out System System.out "No" public class Main {

    //グローバル変数を定義

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        String last = sc.next();
        boolean isInRule = true;
        ArrayList<String> already = new ArrayList<>();
        already.add(last);

        for(int i=1; i<n; i++){
            String input = sc.next();
            if(last.charAt(last.length()-1) != input.charAt(0)){
                isInRule = false;
                break;
            }
            if(already.contains(input)){
                isInRule = false;
            }
            already.add(input);
            last = input;
        }

        if(isInRule){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} public class Main {

    //グローバル変数を定義

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        String last = sc.next();
        boolean isInRule = true;
        ArrayList<String> already = new ArrayList<>();
        already.add(last);

        for(int i=1; i<n; i++){
            String input = sc.next();
            if(last.charAt(last.length()-1) != input.charAt(0)){
                isInRule = false;
                break;
            }
            if(already.contains(input)){
                isInRule = false;
            }
            already.add(input);
            last = input;
        }

        if(isInRule){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} Main
import javax.print.DocFlavor;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.function.BiConsumer;

public class Main {

    //グローバル変数を定義

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        String last = sc.next();
        boolean isInRule = true;
        ArrayList<String> already = new ArrayList<>();
        already.add(last);

        for(int i=1; i<n; i++){
            String input = sc.next();
            if(last.charAt(last.length()-1) != input.charAt(0)){
                isInRule = false;
                break;
            }
            if(already.contains(input)){
                isInRule = false;
            }
            already.add(input);
            last = input;
        }

        if(isInRule){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}
