#include <bits/stdc++.h>
using namespace std;
const int N = 53;
int n, id, g[N];
bool can, vis[N][N][N][N];
string x[] = {"2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K", "A"};
string y[] = {"S", "D", "H", "C"};
map<string, int> hs;
vector<string> B;
void DFS(int x, int a, int b, int c) {
  if (!x) {
    can = true;
    return;
  }
  if (vis[x][a][b][c]) return;
  vis[x][a][b][c] = true;
  if (!can && x > 0 &&
      (B[g[x - 1]][0] == B[g[x]][0] || B[g[x - 1]][1] == B[g[x]][1])) {
    swap(g[x], g[x - 1]);
    DFS(x - 1, g[x - 1], (x - 2 >= 0) ? g[x - 2] : n,
        (x - 3 >= 0) ? g[x - 3] : n);
    swap(g[x], g[x - 1]);
  }
  if (!can && x > 2 &&
      (B[g[x - 3]][0] == B[g[x]][0] || B[g[x - 3]][1] == B[g[x]][1])) {
    swap(g[x], g[x - 3]);
    DFS(x - 1, g[x - 1], (x - 2 >= 0) ? g[x - 2] : n,
        (x - 3 >= 0) ? g[x - 3] : n);
    swap(g[x], g[x - 3]);
  }
}
int main() {
  for (int i = 0; i < 13; ++i)
    for (int j = 0; j < 4; ++j) {
      hs[x[i] + y[j]] = id++;
      B.push_back(x[i] + y[j]);
    }
  scanf("%d", &n);
  char s[4];
  for (int i = 0; i < n; ++i) {
    scanf("%s", s);
    g[i] = hs[s];
  }
  DFS(n - 1, g[n - 1], (n - 2 >= 0) ? g[n - 2] : n,
      (n - 3 >= 0) ? g[n - 3] : n);
  if (can)
    puts("YES");
  else
    puts("NO");
  return 0;
}
