#include <bits/stdc++.h>
using namespace std;
struct node {
  string s;
  bool ok;
  bool operator<(node x) const { return x.s < s; }
};
string a;
int n;
set<node> g;
set<node>::iterator pv;
void kk(int t, node x) {}
bool dfs(int p) {
  node x;
  x.s = a;
  x.ok = 0;
  pv = g.find(x);
  if (pv != g.end()) return (*pv).ok;
  if (p == 0) {
    x.ok = 1;
    kk(1, x);
    g.insert(x);
    return 1;
  }
  string tmp = a;
  for (int i = p - 1; i >= p - 3; i -= 2)
    if (tmp[i << 1] == tmp[p << 1] || tmp[(i << 1) + 1] == tmp[(p << 1) + 1]) {
      a.clear();
      for (int j = 0; j < p; j++) {
        int k = (j == i ? p : j) << 1;
        a += tmp[k];
        a += tmp[k + 1];
      }
      if (dfs(p - 1)) {
        x.ok = 1;
        kk(2, x);
        g.insert(x);
        return 1;
      }
    }
  {
    x.ok = 0;
    kk(3, x);
    g.insert(x);
    return 0;
  }
}
int main() {
  cin >> n;
  string ss;
  for (int i = 0; i < n; i++) cin >> ss, a += ss;
  if (dfs(n - 1))
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
