#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <math.h>
#include <vector>

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

#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#define TRUE (0)
#define FALSE (1)

// This value shold be close to used maximum value.  
#define NUM_MAX 20000000005

// void sort(uint32_t *num, uint32_t size);
uint64_t silver_fox(vector<vector<int64_t>>& monster_arr, uint64_t range, uint64_t attack, uint64_t count);

int main()
{   
 
    vector<vector<int64_t>> monster_arr(0);
    vector<uint64_t> bingo(9);
    vector<uint64_t> num_vec(0);
    vector<bool> result(9);
    // vector<long long> res_vec(0);
    // uint64_t res_arr[NUM_MAX];
    // uint32_t sum = 0;
    uint64_t range, attack;
    uint64_t num;
    // uint64_t result;
    uint64_t sum;

    // uint32_t res_i = 0;
    // string str_temp, str_temp2;
    uint64_t temp, temp2;
    uint64_t i, j, k, l, count, n, o, size;
    // uint32_t count = 0;
    // string str;
    // uint8_t k_flag;
 
    cin >> bingo.at(0) >> bingo.at(1) >> bingo.at(2);
    cin >> bingo.at(3) >> bingo.at(4) >> bingo.at(5);
    cin >> bingo.at(6) >> bingo.at(7) >> bingo.at(8);
    cin >> num;

    for (i=0; i<9; i++) {
        result.at(i) = false;
    }

    for (i=0; i<num; i++) {
        cin >> temp;
        for (j=0; j<9; j++) {
            if ((temp == bingo.at(j)) || (result.at(j) == true)) {
                result.at(j) = true;
            } else {
                result.at(j) = false;
            }
        }
    }

    if (result.at(0) == true) {
        if ((result.at(1) == true) && (result.at(2) == true)) {
            cout << "Yes" << endl;
            return 0;
        } else if ((result.at(3) == true) && (result.at(6) == true)) {
            cout << "Yes" << endl;
            return 0;
        } else if ((result.at(4) == true) && (result.at(8) == true)) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    
    if (result.at(1) == true) {
        if ((result.at(4) == true) && (result.at(7) == true)) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    
    if (result.at(2) == true) {
        if ((result.at(5) == true) && (result.at(8) == true)) {
            cout << "Yes" << endl;
            return 0;
        } else if ((result.at(4) == true) && (result.at(6) == true)) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    if (result.at(3) == true) {
        if ((result.at(4) == true) && (result.at(5) == true)) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    if (result.at(6) == true) {
        if ((result.at(7) == true) && (result.at(8) == true)) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;

    return 0;
}

uint64_t silver_fox(vector<vector<int64_t>>& monster_arr, uint64_t range, uint64_t attack, uint64_t count)
{
    int64_t life, pos, num;
    int64_t i, short_i;

    while (monster_arr.size() != 0) {
        pos = monster_arr[0][0];
        life = monster_arr[0][1];
        count++;
        short_i = 0;

        for (i = 0; i < monster_arr.size(); i++) {
            short_i++;
            if (monster_arr[i][0] < pos + range) {
                monster_arr[i][1] -= attack;
            } else {
                break;
            }
        }

        for (i = short_i - 1; i >= 0; i--) {
            if (monster_arr[i][1] <= 0) {
                monster_arr.erase(monster_arr.begin() + i);
            }
        }
    }

    return count;
}

// void sort(uint32_t *num, uint32_t size) {
//     uint32_t i, j, k;
//     uint32_t sorted_num;
//     uint32_t array[NUM_MAX] = {0};

//     for (i = 1; i < size + 1; i++) {
//         array[num[i - 1]]++;
//     }

//     sorted_num = 0;

//     for (i = 0; i < NUM_MAX; i++) {
//         for (j = 0; j < array[i]; j++) {
//             num[j + sorted_num] = i;
//         }
//         sorted_num += j;
//         j = 0;
//     }

//     return;
// }


Measured memory_bytes: 256