#include <bits/stdc++.h>
using namespace std;
bool dp[55][14 * 4][14 * 4][14 * 4];
int a[55];
int f(char s[]) {
  int f, ss;
  if (s[0] == 'A')
    f = 0;
  else if (s[0] == 'K')
    f = 12;
  else if (s[0] == 'Q')
    f = 11;
  else if (s[0] == 'J')
    f = 10;
  else if (s[0] == 'T')
    f = 9;
  else
    f = s[0] - '1';
  if (s[1] == 'S')
    ss = 0;
  else if (s[1] == 'D')
    ss = 1;
  else if (s[1] == 'H')
    ss = 2;
  else if (s[1] == 'C')
    ss = 3;
  return f * 4 + ss;
}
int main() {
  int i, j, k, r, n, x, y, z, p;
  char s[5];
  scanf("%d", &n);
  for (i = 0; i < n; ++i) {
    scanf("%s", s);
    a[i] = f(s);
  }
  memset(dp, false, sizeof(dp));
  x = a[n - 1];
  if (n > 1)
    y = a[n - 2];
  else
    y = 0;
  if (n > 2)
    z = a[n - 3];
  else
    z = 0;
  dp[n - 1][x][y][z] = true;
  for (i = n - 1; i > 0; --i) {
    for (j = 0; j < 52; ++j) {
      for (k = 0; k < 52; ++k) {
        for (r = 0; r < 52; ++r) {
          if (dp[i][j][k][r]) {
            p = j;
            x = k;
            y = r;
            if (i >= 3)
              z = a[i - 3];
            else
              z = 0;
            if (i > 0 && (p % 4 == x % 4 || p / 4 == x / 4))
              dp[i - 1][p][y][z] = true;
            if (i > 2 && (p % 4 == z % 4 || p / 4 == z / 4))
              dp[i - 1][x][y][p] = true;
          }
        }
      }
    }
  }
  for (i = 0; i < 52; ++i) {
    if (dp[0][i][0][0]) {
      printf("YES\n");
      return 0;
    }
  }
  printf("NO\n");
}
