#include <bits/stdc++.h>
using namespace std;
namespace mainns {
class Solver208B {
 public:
  void run();
};
void Solver208B::run() {
  size_t nCards;
  cin >> nCards;
  string cards = "xxxx";
  for (size_t i = 0; i < nCards; ++i) {
    string card;
    cin >> card;
    cards.append(card);
  }
  nCards += 2;
  unordered_set<string> allowedSuffixes = {cards.substr(cards.length() - 6, 6)};
  for (int i = nCards - 4; i >= 0; --i) {
    unordered_set<string> nextAllowedSuffixes;
    for (auto& suff : allowedSuffixes) {
      if (suff[2] == suff[4] || suff[3] == suff[5])
        nextAllowedSuffixes.insert(cards.substr(2 * i, 2) + suff.substr(0, 2) +
                                   suff.substr(4, 2));
      if (cards[2 * i] == suff[4] || cards[2 * i + 1] == suff[5])
        nextAllowedSuffixes.insert(suff.substr(4, 2) + suff.substr(0, 4));
    }
    allowedSuffixes = move(nextAllowedSuffixes);
  }
  if (allowedSuffixes.empty())
    cout << "NO";
  else
    cout << "YES";
}
}  // namespace mainns
using CurrentSolver = mainns::Solver208B;
int main() {
  ios::sync_with_stdio(false);
  CurrentSolver().run();
  return 0;
}
