#include <bits/stdc++.h>
using namespace std;
const int inf = (1 << 28);
int s2i(string s) {
  int r = 0;
  if (s[0] == 'A')
    r = 0;
  else if (s[0] == 'T')
    r = 9;
  else if (s[0] == 'J')
    r = 10;
  else if (s[0] == 'Q')
    r = 11;
  else if (s[0] == 'K')
    r = 12;
  else
    r = s[0] - '0' - 1;
  if (s[1] == 'S') r += 0 * 13;
  if (s[1] == 'D') r += 1 * 13;
  if (s[1] == 'H') r += 2 * 13;
  if (s[1] == 'C') r += 3 * 13;
  return r;
}
bool ok(int i, int j) {
  if (j == 52) return false;
  int n1 = i % 13, s1 = i / 13;
  int n2 = j % 13, s2 = j / 13;
  return n1 == n2 or s1 == s2;
}
bool dp[53][53][53][53];
int main() {
  int n;
  cin >> n;
  vector<int> cards(n);
  for (int i = 0; i < (int)(n); i++) {
    string s;
    cin >> s;
    cards[i] = s2i(s);
  }
  for (int i = 0; i < (int)(n + 1); i++)
    for (int z = 0; z < (int)(53); z++)
      for (int y = 0; y < (int)(53); y++)
        for (int x = 0; x < (int)(53); x++) dp[i][z][y][x] = false;
  {
    int z = n - 3 >= 0 ? cards[n - 3] : 52;
    int y = n - 2 >= 0 ? cards[n - 2] : 52;
    int x = n - 1 >= 0 ? cards[n - 1] : 52;
    dp[n][z][y][x] = true;
  }
  for (int i = n; i > 0; i--)
    for (int z = 0; z < (int)(53); z++)
      for (int y = 0; y < (int)(53); y++)
        for (int x = 0; x < (int)(53); x++) {
          if (!dp[i][z][y][x]) continue;
          int w = i - 4 >= 0 ? cards[i - 4] : 52;
          if (ok(x, y)) dp[i - 1][w][z][x] = true;
          if (ok(x, w)) dp[i - 1][x][z][y] = true;
        }
  int res = false;
  for (int i = 0; i < (int)(52); i++) res |= dp[1][52][52][i];
  cout << (res ? "YES" : "NO") << endl;
  return 0;
}
