import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      int n = sc.nextInt();
      Set<String> set = new HashSet<>();
      String prev = null;
      boolean isValid = true;
      for (int i = 0; i < n; i++) {
        String s = sc.next();
        if (!isValid) {
          continue;
        }
        if ((prev != null && !s.startsWith(prev.substring(prev.length() - 1, prev.length())))
            || !set.add(s)) {
          isValid = false;
        }
        prev = s;
      }
      System.out.println(isValid ? "Yes" : "No");
    }
  }
} import java.util.HashSet; HashSet java.util import java.util.Scanner; Scanner java.util import java.util.Set; Set java.util public class Main {
  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      int n = sc.nextInt();
      Set<String> set = new HashSet<>();
      String prev = null;
      boolean isValid = true;
      for (int i = 0; i < n; i++) {
        String s = sc.next();
        if (!isValid) {
          continue;
        }
        if ((prev != null && !s.startsWith(prev.substring(prev.length() - 1, prev.length())))
            || !set.add(s)) {
          isValid = false;
        }
        prev = s;
      }
      System.out.println(isValid ? "Yes" : "No");
    }
  }
} Main public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      int n = sc.nextInt();
      Set<String> set = new HashSet<>();
      String prev = null;
      boolean isValid = true;
      for (int i = 0; i < n; i++) {
        String s = sc.next();
        if (!isValid) {
          continue;
        }
        if ((prev != null && !s.startsWith(prev.substring(prev.length() - 1, prev.length())))
            || !set.add(s)) {
          isValid = false;
        }
        prev = s;
      }
      System.out.println(isValid ? "Yes" : "No");
    }
  } main {
    try (Scanner sc = new Scanner(System.in)) {
      int n = sc.nextInt();
      Set<String> set = new HashSet<>();
      String prev = null;
      boolean isValid = true;
      for (int i = 0; i < n; i++) {
        String s = sc.next();
        if (!isValid) {
          continue;
        }
        if ((prev != null && !s.startsWith(prev.substring(prev.length() - 1, prev.length())))
            || !set.add(s)) {
          isValid = false;
        }
        prev = s;
      }
      System.out.println(isValid ? "Yes" : "No");
    }
  } try (Scanner sc = new Scanner(System.in)) {
      int n = sc.nextInt();
      Set<String> set = new HashSet<>();
      String prev = null;
      boolean isValid = true;
      for (int i = 0; i < n; i++) {
        String s = sc.next();
        if (!isValid) {
          continue;
        }
        if ((prev != null && !s.startsWith(prev.substring(prev.length() - 1, prev.length())))
            || !set.add(s)) {
          isValid = false;
        }
        prev = s;
      }
      System.out.println(isValid ? "Yes" : "No");
    } {
      int n = sc.nextInt();
      Set<String> set = new HashSet<>();
      String prev = null;
      boolean isValid = true;
      for (int i = 0; i < n; i++) {
        String s = sc.next();
        if (!isValid) {
          continue;
        }
        if ((prev != null && !s.startsWith(prev.substring(prev.length() - 1, prev.length())))
            || !set.add(s)) {
          isValid = false;
        }
        prev = s;
      }
      System.out.println(isValid ? "Yes" : "No");
    } Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc Set<String> set = new HashSet<>(); set new HashSet<>() String prev = null; prev null boolean isValid = true; isValid true for (int i = 0; i < n; i++) {
        String s = sc.next();
        if (!isValid) {
          continue;
        }
        if ((prev != null && !s.startsWith(prev.substring(prev.length() - 1, prev.length())))
            || !set.add(s)) {
          isValid = false;
        }
        prev = s;
      } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
        String s = sc.next();
        if (!isValid) {
          continue;
        }
        if ((prev != null && !s.startsWith(prev.substring(prev.length() - 1, prev.length())))
            || !set.add(s)) {
          isValid = false;
        }
        prev = s;
      } {
        String s = sc.next();
        if (!isValid) {
          continue;
        }
        if ((prev != null && !s.startsWith(prev.substring(prev.length() - 1, prev.length())))
            || !set.add(s)) {
          isValid = false;
        }
        prev = s;
      } String s = sc.next(); s sc.next() sc.next sc if (!isValid) {
          continue;
        } !isValid isValid {
          continue;
        } continue; if ((prev != null && !s.startsWith(prev.substring(prev.length() - 1, prev.length())))
            || !set.add(s)) {
          isValid = false;
        } (prev != null && !s.startsWith(prev.substring(prev.length() - 1, prev.length())))
            || !set.add(s) (prev != null && !s.startsWith(prev.substring(prev.length() - 1, prev.length()))) prev != null prev null !s.startsWith(prev.substring(prev.length() - 1, prev.length())) s.startsWith(prev.substring(prev.length() - 1, prev.length())) s.startsWith s prev.substring(prev.length() - 1, prev.length()) prev.substring prev prev.length() - 1 prev.length() prev.length prev 1 prev.length() prev.length prev !set.add(s) set.add(s) set.add set s {
          isValid = false;
        } isValid = false isValid false prev = s prev s System.out.println(isValid ? "Yes" : "No") System.out.println System.out System System.out isValid ? "Yes" : "No" isValid "Yes" "No" String[] args args public class Main {
  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      int n = sc.nextInt();
      Set<String> set = new HashSet<>();
      String prev = null;
      boolean isValid = true;
      for (int i = 0; i < n; i++) {
        String s = sc.next();
        if (!isValid) {
          continue;
        }
        if ((prev != null && !s.startsWith(prev.substring(prev.length() - 1, prev.length())))
            || !set.add(s)) {
          isValid = false;
        }
        prev = s;
      }
      System.out.println(isValid ? "Yes" : "No");
    }
  }
} public class Main {
  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      int n = sc.nextInt();
      Set<String> set = new HashSet<>();
      String prev = null;
      boolean isValid = true;
      for (int i = 0; i < n; i++) {
        String s = sc.next();
        if (!isValid) {
          continue;
        }
        if ((prev != null && !s.startsWith(prev.substring(prev.length() - 1, prev.length())))
            || !set.add(s)) {
          isValid = false;
        }
        prev = s;
      }
      System.out.println(isValid ? "Yes" : "No");
    }
  }
} Main
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      int n = sc.nextInt();
      Set<String> set = new HashSet<>();
      String prev = null;
      boolean isValid = true;
      for (int i = 0; i < n; i++) {
        String s = sc.next();
        if (!isValid) {
          continue;
        }
        if ((prev != null && !s.startsWith(prev.substring(prev.length() - 1, prev.length())))
            || !set.add(s)) {
          isValid = false;
        }
        prev = s;
      }
      System.out.println(isValid ? "Yes" : "No");
    }
  }
}
