#include <bits/stdc++.h>
using namespace std;
char a[] = "23456789TJQKA";
char b[] = "SDHC";
int Get() {
  char s[3];
  scanf("%s", s);
  int i = 0;
  while (a[i] != s[0]) ++i;
  int j = 0;
  while (b[j] != s[1]) ++j;
  return i * 4 + j;
}
int Good(int first, int second) {
  return (first / 4 == second / 4) || (first % 4 == second % 4);
}
int arr[100];
int n;
bool dp[55][55][55][55];
bool Solve(int n, int first, int second, int z) {
  if (n == 1) return 1;
  if (n == 2) return Good(first, second);
  if (n == 3) return Good(z, second) && Good(z, first);
}
void Out(int first) {
  putchar(a[first / 4]);
  putchar(b[first % 4]);
}
int main() {
  scanf("%d", &n);
  for (int i = (0); i < (int)(n); i++) arr[i] = Get();
  memset(dp, 0, sizeof(dp));
  bool ans = false;
  if (n <= 3) {
    ans = Solve(n, arr[0], arr[1], arr[2]);
  } else {
    dp[n - 4][arr[n - 3]][arr[n - 2]][arr[n - 1]] = true;
    for (int k = n - 4; k >= 0; k--) {
      for (int first = (0); first < (int)(52); first++)
        for (int second = (0); second < (int)(52); second++)
          for (int z = (0); z < (int)(52); z++) {
            if (dp[k][first][second][z]) {
              if (k == 0) {
                if (Good(second, z)) ans |= Solve(3, arr[k], first, z);
                if (Good(arr[k], z)) ans |= Solve(3, z, first, second);
              } else {
                if (Good(second, z)) dp[k - 1][arr[k]][first][z] = true;
                if (Good(arr[k], z)) dp[k - 1][z][first][second] = true;
              }
            }
          }
    }
  }
  puts(ans ? "YES" : "NO");
  return 0;
}
