Module Module1

    Sub Main()

        Dim al(8) As Integer

        For i As Integer = 0 To 2
            Dim tmp As String() = Split(Console.ReadLine(), " ")
            For j As Integer = 0 To 2
                al((3 * i) + j) = CInt(tmp(j))
            Next
        Next

        Dim N As Integer = CInt(Console.ReadLine())
        For i As Integer = 0 To N - 1
            Dim b As Integer = CInt(Console.ReadLine())
            For c As Integer = 0 To 8
                If al(c) = b Then
                    al(c) = 0
                    Exit For
                End If
            Next
        Next

        If al(0) + al(1) + al(2) = 0 OrElse al(3) + al(4) + al(5) = 0 OrElse al(6) + al(7) + al(8) = 0 OrElse al(0) + al(3) + al(6) = 0 OrElse al(1) + al(4) + al(7) = 0 OrElse al(2) + al(5) + al(8) = 0 OrElse al(0) + al(4) + al(8) = 0 OrElse al(2) + al(4) + al(6) = 0 Then
            Console.WriteLine("Yes")
        Else
            Console.WriteLine("No")
        End If

    End Sub

End Module
