Module Module1

    Sub Main()
        Dim input As String
        Dim suuzisu As Integer

        Dim bingocard(2, 2) As Integer


        For i As Integer = 0 To 2
            Dim tempsuretsu(2) As String
            tempsuretsu = Console.ReadLine().Split(" "c)
            bingocard(i, 0) = CType(tempsuretsu(0), Integer)
            bingocard(i, 1) = CType(tempsuretsu(1), Integer)
            bingocard(i, 2) = CType(tempsuretsu(2), Integer)
        Next

        suuzisu = CType(Console.ReadLine(), Integer)

        Dim checkkazu(suuzisu - 1) As Integer

        For i As Integer = 0 To suuzisu - 1
            checkkazu(i) = CType(Console.ReadLine(), Integer)
        Next

        '--ここから穴あけ

        For Each kazu In checkkazu
            For bingorow As Integer = 0 To 2
                For bingocol As Integer = 0 To 2
                    If bingocard(bingorow, bingocol) = kazu Then
                        bingocard(bingorow, bingocol) = -1
                    End If
                Next
            Next
        Next

        Dim bingoflg As Boolean = False
        '--ここからチェック
        For t As Integer = 0 To 2
            If bingocard(t, 0) = bingocard(t, 1) AndAlso
               bingocard(t, 1) = bingocard(t, 2) AndAlso
               bingocard(t, 0) = -1 Then
                bingoflg = True
            End If

            If bingocard(0, t) = bingocard(1, t) AndAlso
               bingocard(1, t) = bingocard(2, t) AndAlso
               bingocard(2, t) = -1 Then
                bingoflg = True
            End If
        Next

        If bingocard(0, 0) = bingocard(1, 1) AndAlso
               bingocard(1, 1) = bingocard(2, 2) AndAlso
               bingocard(2, 2) = -1 Then
            bingoflg = True
        End If

        If bingocard(0, 2) = bingocard(1, 1) AndAlso
               bingocard(1, 1) = bingocard(2, 0) AndAlso
               bingocard(2, 0) = -1 Then
            bingoflg = True
        End If


        If bingoflg Then
            Console.WriteLine("Yes")
        Else
            Console.WriteLine("No")
        End If






        Console.ReadKey()


    End Sub




End Module
