/*..............IN THE NAME OF ALLAH.............*/
/**
*     => Md. Sajjat Hosen
*     => Department of Computer Science and Engineering
*     => Bangabandhu Sheikh Mujibur Rahman Science and Technology University
**/

/*..................! TRY ONCE MORE !..................*/

/*...Part - 01...*/

#include <bits/stdc++.h>
using namespace std ;

/*...Part - 02...*/

typedef long long               ll ;
typedef long double             ld ;
typedef unsigned long long      ull ;
typedef pair<int,int>           pii ;
typedef pair<ll,ll>             pll ;
typedef vector<int>             vi ;
typedef vector<ll>              vll ;
typedef vector<vector<int>>     vvi ;

int Int(){int x ; scanf("%d",&x) ; return x ;}
ll Long(){ll x ; scanf("%lld",&x) ; return x ;}
float Float(){float x ; scanf("%f",&x) ; return x ;}
double Double(){double x ; scanf("%lf",&x); return x;}

/*...Part - 03...*/
/*....Debugger....*/

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl ;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << ' ' ;
    err(++it, args...);
}

/*...Part - 04...*/
/*...Needed to change according to problem requirements...*/

const int N          = (int)2e5 + 5 ;
const int maxN       = (int)1e6 + 6 ;
const ll  Mod        = (ll)1e9 + 7 ;
const int inf        = (int)2e9 ;
const ll  Inf        = (ll)1e18 ;

/*..........................................................*/
/*...Part - 05...*/

#define     debug(x)    cerr << #x << " = " << x << '\n' ;
#define     rep(i,b,e)  for(__typeof(e) i = (b) ; i != (e + 1) - 2 * ((b) > (e))  ; i += 1 - 2 * ((b) > (e)))
#define     Int         Int()
#define     Long        Long()
#define     Float       Float()
#define     Double      Double()
#define     all(x)      x.begin() , x.end()
#define     sz(x)       (int)x.size()
#define     ff          first
#define     ss          second
#define     pb          push_back
#define     eb          emplace_back
#define     mem(a)      memset(a , 0 ,sizeof a)
#define     memn(a)     memset(a , -1 ,sizeof a)

/*...Part - 06...*/
/*...... ! Code start from here ! ......*/


inline void Yes(){printf("Yes\n");}
inline void No(){printf("No\n");}
inline void YES(){printf("YES\n");}
inline void NO(){printf("NO\n");}

int main(){
    //freopen("input.txt","r",stdin);
    int test = 1 , tc = 0 ;
    while(test--){
        int a[4][4];
        int vis[4][4];
        int n, m, flag = 0, x;
        memset(vis, false, sizeof vis);
        for(int i = 1; i <= 3; ++i){
            for(int j = 1; j <= 3; ++j){
                a[i][j] = Int;
            }
        }
        n = Int;
        m = n;
        while(m--){
            x = Int;
            for(int i = 1; i <= 3; ++i){
                for(int j = 1; j <= 3; ++j){
                    if(a[i][j] == x){
                        vis[i][j]++;
                    }
                }
            }
        }
        for(int i = 1; i <= 3; i++){
            if(vis[i][1] > 0 and vis[i][2] > 0 and vis[i][3] > 0){
                flag = 1;
                break;
            }
        }

        for(int i = 1; i <= 3; i++){
            if(vis[1][i] > 0 and vis[2][i] > 0 and vis[3][i] > 0){
                flag = 1;
                break;
            }
        }
        if(vis[1][1] > 0 and vis[2][2] > 0 and vis[3][3] > 0)
            flag = 1;
        if(vis[1][3] > 0 and vis[2][2] > 0 and vis[3][1] > 0)
            flag = 1;
        if(flag) Yes();
        else No();
    }
    return 0 ;
}

/*...Always look at the part - 04...*/
/*...............END................*/

Measured memory_bytes: 256