#include <bits/stdc++.h>
using namespace std;
class A {
 public:
  void solve() {
    string s;
    cin >> s;
    string ans;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] != 'W')
        ans += s[i];
      else {
        if (i + 2 < s.size() && s[i + 1] == 'U' && s[i + 2] == 'B') {
          i += 2;
          if (!ans.empty() && ans.back() != ' ') ans += ' ';
        } else
          ans += s[i];
      }
    }
    cout << ans << '\n';
  }
};
class B {
 public:
  void solve() {
    int n;
    cin >> n;
    string s;
    for (int i = 0; i < n; i++) {
      string x;
      cin >> x;
      s.append(x);
    }
    if (n == 1) {
      cout << "YES" << '\n';
      return;
    }
    set<string> vis;
    vis.insert(s);
    queue<string> q;
    q.push(s);
    while (!q.empty()) {
      auto u = q.front();
      q.pop();
      if (u.size() == 2) {
        cout << "YES" << '\n';
        return;
      }
      int len = u.size();
      if (u[len - 3] == u[len - 1] || u[len - 4] == u[len - 2]) {
        string temp = u;
        temp[len - 3] = temp[len - 1];
        temp[len - 4] = temp[len - 2];
        temp.pop_back();
        temp.pop_back();
        if (!vis.count(temp)) {
          vis.insert(temp);
          q.push(temp);
        }
      }
      if (len / 2 >= 4) {
        if (u[len - 1] == u[len - 7] || u[len - 2] == u[len - 8]) {
          string temp = u;
          temp[len - 7] = temp[len - 1];
          temp[len - 8] = temp[len - 2];
          temp.pop_back();
          temp.pop_back();
          if (!vis.count(temp)) {
            q.push(temp);
            vis.insert(temp);
          }
        }
      }
    }
    cout << "NO" << '\n';
  }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  B ans;
  ans.solve();
  return 0;
}
