#include <bits/stdc++.h>
using namespace std;
struct node {
  char x, y;
} a[60];
char s[10];
int f[55][15][5][15][5][15][5];
int flag = 0;
int dfs(int y) {
  if (y > 3 &&
      f[y][a[y].x][a[y].y][a[y - 2].x][a[y - 2].y][a[y - 1].x][a[y - 1].y] == 0)
    return 0;
  if (flag) return 1;
  if (y <= 1) {
    flag = 1;
    return 1;
  }
  if (y > 1) {
    if (a[y].x == a[y - 1].x || a[y].y == a[y - 1].y) {
      int c1 = a[y - 1].x, c2 = a[y - 1].y;
      a[y - 1].x = a[y].x, a[y - 1].y = a[y].y;
      if (dfs(y - 1)) {
        flag = 1;
        if (y > 3)
          f[y][a[y].x][a[y].y][a[y - 2].x][a[y - 2].y][a[y - 1].x][a[y - 1].y] =
              1;
        return 1;
      }
      a[y - 1].x = c1, a[y - 1].y = c2;
    }
  }
  if (y > 3) {
    if (a[y].x == a[y - 3].x || a[y].y == a[y - 3].y) {
      int c1 = a[y - 3].x, c2 = a[y - 3].y;
      a[y - 3].x = a[y].x, a[y - 3].y = a[y].y;
      if (dfs(y - 1)) {
        flag = 1;
        f[y][a[y].x][a[y].y][a[y - 2].x][a[y - 2].y][a[y - 1].x][a[y - 1].y] =
            1;
        return 1;
      }
      a[y - 3].x = c1, a[y - 3].y = c2;
    }
  }
  if (y > 3)
    f[y][a[y].x][a[y].y][a[y - 2].x][a[y - 2].y][a[y - 1].x][a[y - 1].y] = 0;
  return 0;
}
int main() {
  int n, i;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%s", s);
    a[i].x = s[0], a[i].y = s[1];
    if (s[0] == 'T')
      a[i].x = 10;
    else if (s[0] == 'J')
      a[i].x = 11;
    else if (s[0] == 'Q')
      a[i].x = 12;
    else if (s[0] == 'K')
      a[i].x = 13;
    else if (s[0] == 'A')
      a[i].x = 1;
    else
      a[i].x = s[0] - '0';
    if (s[1] == 'S')
      a[i].y = 1;
    else if (s[1] == 'D')
      a[i].y = 2;
    else if (s[1] == 'H')
      a[i].y = 3;
    else
      a[i].y = 4;
  }
  flag = 0;
  memset(f, -1, sizeof(f));
  if (dfs(n))
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
