#include <bits/stdc++.h>
using namespace std;
map<string, bool> v;
string a[105];
int n;
set<string> s[105];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int i, j, k;
  for (i = 0; i < 105; i++) s[i].clear();
  cin >> n;
  string b = "";
  for (i = 1; i <= n; i++) cin >> a[i], b += a[i];
  s[n - 1].insert(b);
  set<string>::iterator it;
  if (n == 1) {
    cout << "YES";
    return 0;
  }
  for (i = n - 1; i >= 0; i--) {
    for (it = s[i].begin(); it != s[i].end(); it++) {
      string c = "", d = "", a = *it;
      int x = 2 * i;
      int y = 2 * i + 1;
      if (i >= 1 && (a[x - 2] == a[x] || a[y] == a[y - 2])) {
        if (i == 1) {
          cout << "YES";
          return 0;
        }
        for (int k = 0; k < 2 * i; k++) c += a[k];
        c[x - 2] = a[x], c[y - 2] = a[y];
        s[i - 1].insert(c);
      }
      if (i >= 3 && (a[x - 6] == a[x] || a[y] == a[y - 6])) {
        for (int k = 0; k < 2 * i; k++) d += a[k];
        d[x - 6] = a[x], d[y - 6] = a[y];
        s[i - 1].insert(d);
      }
    }
    s[i].clear();
  }
  cout << "NO";
  return 0;
}
