#include <bits/stdc++.h>
using namespace std;
const int MAXN = 52;
map<int, map<int, map<int, map<int, map<int, int> > > > > mp;
struct data {
  char suit, value;
  int v() {
    if (value == 'A') return 1;
    if (value >= '2' && value <= '9') return value - '0';
    if (value == 'T') return 10;
    if (value == 'J') return 11;
    if (value == 'Q') return 12;
    if (value == 'K') return 13;
  }
  int get() {
    int type;
    if (suit == 'C') type = 0;
    if (suit == 'S') type = 1;
    if (suit == 'D') type = 2;
    if (suit == 'H') type = 3;
    return type * 13 + (v() - 1);
  }
} card[MAXN];
bool dfs(int pos) {
  if (pos == 0) return true;
  if (pos - 3 >= 0) {
    if (mp[pos][card[pos].get()][card[pos - 1].get()][card[pos - 2].get()]
          [card[pos - 3].get()])
      return false;
    if (card[pos].suit == card[pos - 3].suit ||
        card[pos].value == card[pos - 3].value) {
      swap(card[pos - 3].suit, card[pos].suit);
      swap(card[pos - 3].value, card[pos].value);
      if (dfs(pos - 1)) return true;
      swap(card[pos - 3].value, card[pos].value);
      swap(card[pos - 3].suit, card[pos].suit);
    }
  }
  if (card[pos].suit == card[pos - 1].suit ||
      card[pos].value == card[pos - 1].value) {
    swap(card[pos - 1].suit, card[pos].suit);
    swap(card[pos - 1].value, card[pos].value);
    if (dfs(pos - 1)) return true;
    swap(card[pos - 1].value, card[pos].value);
    swap(card[pos - 1].suit, card[pos].suit);
  }
  if (pos - 3 >= 0) {
    mp[pos][card[pos].get()][card[pos - 1].get()][card[pos - 2].get()]
      [card[pos - 3].get()] = true;
  }
  return false;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf(" %c%c", &card[i].value, &card[i].suit);
  }
  mp.clear();
  puts(dfs(n - 1) ? "YES" : "NO");
}
