#include <bits/stdc++.h>
using namespace std;
char s[5];
struct State {
  int n, c1, c2, c3;
  State() {}
  State(int n, int c1, int c2, int c3) : n(n), c1(c1), c2(c2), c3(c3) {}
} Q[55 * 55 * 55 * 55];
int v[55][55][55][55], n, c[55], x, c1, c2, c3, AC = 0;
int Convert(char *s) {
  int Q = 0;
  if ('2' <= s[0] <= '9') Q = s[0] - '0' - 1;
  if (s[0] == 'T') Q = 9;
  if (s[0] == 'J') Q = 10;
  if (s[0] == 'Q') Q = 11;
  if (s[0] == 'K') Q = 12;
  if (s[0] == 'A') Q = 0;
  if (s[1] == 'S') Q += 13 * 0;
  if (s[1] == 'D') Q += 13 * 1;
  if (s[1] == 'H') Q += 13 * 2;
  if (s[1] == 'C') Q += 13 * 3;
  return Q;
}
int Check(int x, int y) {
  if ((x % 13) == (y % 13)) return 1;
  if ((x / 13) == (y / 13)) return 1;
  return 0;
}
int main() {
  scanf("%d", &n);
  for (int i = (0); i < (n); i++) {
    scanf("%s", s);
    c[i] = Convert(s);
  }
  if (n >= 3) {
    AC = 0;
    Q[0] = State(n - 1, c[n - 1], c[n - 2], c[n - 3]);
    v[n - 1][c[n - 1]][c[n - 2]][c[n - 3]] = 1;
    for (int i = 0, j = 0; i <= j; i++) {
      x = Q[i].n;
      c1 = Q[i].c1;
      c2 = Q[i].c2;
      c3 = Q[i].c3;
      if (x == 2) {
        if (Check(c1, c2) && Check(c1, c3)) AC = 1;
        continue;
      } else {
        if (Check(c1, c2)) {
          if (!v[x - 1][c1][c3][c[x - 3]]) {
            v[x - 1][c1][c3][c[x - 3]] = 1;
            Q[++j] = State(x - 1, c1, c3, c[x - 3]);
          }
        }
        if (Check(c1, c[x - 3])) {
          if (!v[x - 1][c2][c3][c1]) {
            v[x - 1][c2][c3][c1] = 1;
            Q[++j] = State(x - 1, c2, c3, c1);
          }
        }
      }
    }
  } else {
    if (n == 1 || (n == 2 && Check(c[0], c[1])))
      AC = 1;
    else
      AC = 0;
  }
  printf("%s\n", AC == 1 ? "YES" : "NO");
  return 0;
}
