#include <bits/stdc++.h>
using namespace std;
vector<int> al;
int n;
string c1 = "23456789TJQKA";
string c2 = "SDHC";
int ha[256];
int rec[52][52][52][52];
bool mat(int a, int b) {
  bool r = ((a % 4) == (b % 4)) || ((a / 4) == (b / 4));
  return r;
}
int dp(int x, int a, int b, int c) {
  int *p = &rec[x][a][b][c];
  if (*p > 0) return *p;
  if (x == 0) return *p = (mat(c, a) && mat(c, b)) ? 2 : 1;
  if ((mat(al[x - 1], c) && dp(x - 1, c, a, b) == 2) ||
      (mat(b, c) && dp(x - 1, al[x - 1], a, c) == 2))
    return *p = 2;
  else
    return *p = 1;
}
int main(int argc, const char *argv[]) {
  cin >> n;
  for (int i = 0; i < 13; i++) ha[c1[i]] = i;
  for (int i = 0; i < 4; i++) ha[c2[i]] = i;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    int x = ha[s[1]];
    x += 4 * ha[s[0]];
    al.push_back(x);
  }
  bool r = true;
  if (n - 3 >= 0)
    r = dp(n - 3, al[n - 3], al[n - 2], al[n - 1]) == 2;
  else if (n == 2)
    r = mat(al[n - 1], al[n - 2]);
  if (r)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
