#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long inf = 1e16;
const long long ninf = LLONG_MIN;
const double eps = 1e-12;
const long long N = 1000005;
const long long LOGN = 19;
const double PI = 3.14159265358979323846;
long long n;
long long c[N];
bool vis[55][55][55][55], dp[55][55][55][55];
bool check(long long x, long long y) {
  if (x / 13 == y / 13 || x % 13 == y % 13) return true;
  return false;
}
bool solve(long long i, long long x, long long y, long long z) {
  if (i == 0) return true;
  if (vis[i][x][y][z]) return dp[i][x][y][z];
  bool ret = false;
  vis[i][x][y][z] = true;
  if (i >= 1 && check(x, y)) {
    long long t = 54;
    if (i >= 3) t = c[i - 3];
    ret |= solve(i - 1, x, z, c[i - 3]);
  }
  if (i >= 3 && check(x, c[i - 3])) {
    ret |= solve(i - 1, y, z, x);
  }
  dp[i][x][y][z] = ret;
  return ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  map<char, long long> a, b;
  b['S'] = 0;
  b['H'] = 1;
  b['D'] = 2;
  b['C'] = 3;
  long long x = 2;
  for (char c = '2'; c <= '9'; c++) a[c] = x++;
  a['T'] = 0;
  a['J'] = 1;
  a['Q'] = 10;
  a['K'] = 11;
  a['A'] = 12;
  for (int i = 0; i < n; i++) {
    char c1, c2;
    cin >> c1 >> c2;
    c[i] = a[c1] + b[c2] * 13;
  }
  long long xx = 54;
  long long yy = 54;
  if (n - 2 >= 0) xx = c[n - 2];
  if (n - 3 >= 0) yy = c[n - 3];
  if (solve(n - 1, c[n - 1], xx, yy))
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
