#include <bits/stdc++.h>
using namespace std;
int i, j, n;
char ch1[] = {'2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'A', 'K'};
char ch2[] = {'S', 'D', 'H', 'C'};
bool dp[80][64][64][64];
int a[100];
bool ok(int l, int r) {
  if ((l & 3) == (r & 3)) return true;
  if ((l >> 2) == (r >> 2)) return true;
  return false;
}
bool solve() {
  dp[n - 2][a[n]][a[n - 1]][a[n - 2]] = 1;
  for (int i = n - 2; i > 7; i--) {
    for (int l1 = 0; l1 < 64; l1++) {
      for (int l2 = 0; l2 < 64; l2++) {
        for (int l3 = 0; l3 < 64; l3++) {
          if (!dp[i][l1][l2][l3]) continue;
          if (ok(l1, l2)) dp[i - 1][l1][l3][a[i - 1]] = 1;
          if (ok(l1, a[i - 1])) dp[i - 1][l2][l3][l1] = 1;
        }
      }
    }
  }
  for (int i = 0; i < 64; i++) {
    if (dp[9][i][63][63]) return true;
  }
  return false;
}
int main() {
  scanf("%d", &n);
  n += 10;
  for (i = 10; i >= 1; i--) a[i] = 63;
  for (i = 11; i <= n; i++) {
    char s[10];
    scanf("%2s", s);
    for (j = 0; j < 13; j++) {
      if (s[0] == ch1[j]) a[i] = (j << 2);
    }
    for (j = 0; j < 4; j++) {
      if (s[1] == ch2[j]) a[i] += (j);
    }
  }
  bool ans = solve();
  if (ans)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
