/**
 * Created By: Anonyman637
 * Created On: 3/5/2020 10:11:55 PM
 */

/* =============================================================================
   ================================== HEADERS ==================================
   ========================================================================== */

#include <cstdio>
#include <string>

/* =============================================================================
   ================================= TYPEDEFS ==================================
   ========================================================================== */

typedef char i8;
typedef short i16;
typedef int i32;
typedef long long i64;

typedef unsigned char ui8;
typedef unsigned short ui16;
typedef unsigned int ui32;
typedef unsigned long long ui64;

using namespace std;

/* =============================================================================
   ================================== MACROS ===================================
   ========================================================================== */

#ifdef DEBUG
#define debug(format, ...) printf(format, __VA_ARGS__)
#else
#define debug(format, ...) 
#endif

#ifdef FILEIO
#define INFILE "fileio\\"__FILE__"In.txt"
#define OUTFILE "fileio\\"__FILE__"Out.txt"
#endif

/* =============================================================================
   ================================== GLOBALS ==================================
   ========================================================================== */


/* =============================================================================
   =================================== SETUP ===================================
   ========================================================================== */

i32 setup() {

#ifdef FILEIO
        if(freopen(INFILE, "r", stdin) == NULL) return 401;
        if(freopen(OUTFILE, "w", stdout) == NULL) return 402;
#endif

        return 0;
}


/* =============================================================================
   ================================= FUNCTIONS =================================
   ========================================================================== */

i32 main() {

        i32 errorInSetup = setup();
        if (errorInSetup) exit(errorInSetup);

        i32 i, t;
        i32 table[9];
        for (i = 0; i < 9; ++i) {
                scanf("%d", &table[i]);
        }

        scanf("%d", &t);
        while (t--) {
                i32 n;
                scanf("%d", &n);
                for (i = 0; i < 9; ++i) {
                        if (n == table[i]) table[i] = -1;
                }
        }

        for (i = 0; i < 9; ++i) {
                if (table[i] == -1) table[i] = 1;
                else table[i] = 0;
        }

        if (table[0] && table[1] && table[2]) printf("Yes");
        else if (table[3] && table[4] && table[5]) printf("Yes");
        else if (table[6] && table[7] && table[8]) printf("Yes");
        else if (table[0] && table[3] && table[6]) printf("Yes");
        else if (table[1] && table[4] && table[7]) printf("Yes");
        else if (table[2] && table[5] && table[8]) printf("Yes");
        else if (table[0] && table[4] && table[8]) printf("Yes");
        else if (table[2] && table[4] && table[6]) printf("Yes");
        else printf("No");
                

        return 0;
}


Measured memory_bytes: 128