#include <bits/stdc++.h>
using namespace std;
const int MAXN = 57;
const int MOD = 1000000007;
const int INF = 2147483647;
const double EPS = 1e-8;
const string VALUE = "23456789TJQKA";
const string SUIT = "SDHC";
const int CNTV = VALUE.size();
const int CNTS = SUIT.size();
string i2s[MAXN];
map<string, int> s2i;
struct Card {
  int v;
  Card() {}
  Card(int v) : v(v) {}
  bool operator==(const Card& c) const {
    return (v % CNTS == c.v % CNTS || v / CNTS == c.v / CNTS);
  }
  friend istream& operator>>(istream& is, Card& c) {
    string s;
    is >> s;
    c.v = s2i[s];
    return is;
  }
};
int i, j, k, l, n, m, p, t, x, y, z, ans, cnt, tcase, xcase;
string s;
bool dp[MAXN][MAXN][MAXN][MAXN];
Card a[MAXN];
bool same(int a, int b) { return Card(a) == Card(b); }
void init() {
  string s = "  ";
  int x = 0;
  s2i.clear();
  for (int i = 0; i < CNTV; i++) {
    for (int j = 0; j < CNTS; j++) {
      s[0] = VALUE[i];
      s[1] = SUIT[j];
      x = i * CNTS + j;
      i2s[x] = s;
      s2i[s] = x;
    }
  }
}
int main() {
  init();
  while (cin >> n) {
    memset(dp, 0, sizeof(dp));
    for (i = 1; i <= n; i++) {
      cin >> a[i];
    }
    if (n == 1) {
      cout << "YES" << endl;
      continue;
    }
    for (j = 0; j < MAXN; j++) {
      for (k = 0; k < MAXN; k++) {
        for (l = 0; l < MAXN; l++) {
          dp[1][j][k][l] = true;
          if (same(k, l)) {
            dp[2][j][k][l] = true;
            if (same(j, l)) dp[3][j][k][l] = true;
          }
        }
      }
    }
    for (i = 4; i <= n; i++) {
      for (j = 0; j < MAXN; j++) {
        for (k = 0; k < MAXN; k++) {
          for (l = 0; l < MAXN; l++) {
            if (same(k, l)) {
              dp[i][j][k][l] |= dp[i - 1][a[i - 3].v][j][l];
            }
            if (same(l, a[i - 3].v)) {
              dp[i][j][k][l] |= dp[i - 1][l][j][k];
            }
          }
        }
      }
    }
    if (dp[n][a[n - 2].v][a[n - 1].v][a[n].v]) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
