#include <bits/stdc++.h>
long long mpow(long long a, long long n, long long mod) {
  long long ret = 1;
  long long b = a;
  while (n) {
    if (n & 1) ret = (ret * b) % mod;
    b = (b * b) % mod;
    n >>= 1;
  }
  return (long long)ret;
}
using namespace std;
int a[55], n;
int dp[55][55][55][55];
int go(int i, int x1, int x2, int x3) {
  if (i == n) {
    return 1;
  }
  int &ret = dp[i][x1][x2][x3];
  if (ret != -1) return ret;
  ret = 0;
  if (i + 1 <= n) {
    if (x1 % 13 == x2 % 13 || (x1 / 13 == x2 / 13))
      ret |= go(i + 1, x1, x3, a[i + 3]);
  }
  if (i + 3 <= n) {
    if (x1 % 13 == a[i + 3] % 13 || (x1 / 13 == a[i + 3] / 13))
      ret |= go(i + 1, x2, x3, x1);
  }
  return ret;
}
void solve() {
  scanf("%d", &n);
  memset(a, -1, sizeof(a));
  for (int i = 1; i <= n; i++) {
    string s;
    cin >> s;
    int x = 0;
    if (s[1] == 'H') {
      x = 0;
    }
    if (s[1] == 'C') {
      x = 13;
    }
    if (s[1] == 'D') {
      x = 26;
    }
    if (s[1] == 'S') {
      x = 39;
    }
    if (s[0] >= '2' && s[0] <= '9') x += (s[0] - '0');
    if (s[0] == 'J') x += 10;
    if (s[0] == 'Q') x += 11;
    if (s[0] == 'K') x += 12;
    if (s[0] == 'A') x += 0;
    a[n - (i - 1)] = x;
  }
  memset(dp, -1, sizeof(dp));
  if (go(1, a[1], a[2], a[3]))
    printf("YES");
  else
    printf("NO");
}
int main() {
  int t = 1;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
