Module B
    Sub Main(ByVal args() As String)
        Dim arr1() As String = Split(Console.ReadLine())
        Dim arr2() As String = Split(Console.ReadLine())
        Dim arr3() As String = Split(Console.ReadLine())
        Dim bingo(,) As Integer = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}
        Dim n As Integer = Integer.Parse(Console.ReadLine())
        Dim a1, a2, a3, a4, a5, a6, a7, a8 As Integer

        For i As Integer = 1 To n
            Select Case Console.ReadLine()
                Case arr1(0)
                    bingo(0, 0) = 1
                Case arr1(1)
                    bingo(0, 1) = 1
                Case arr1(2)
                    bingo(0, 2) = 1
                Case arr2(0)
                    bingo(1, 0) = 1
                Case arr2(1)
                    bingo(1, 1) = 1
                Case arr2(2)
                    bingo(1, 2) = 1
                Case arr3(0)
                    bingo(2, 0) = 1
                Case arr3(1)
                    bingo(2, 1) = 1
                Case arr3(2)
                    bingo(2, 2) = 1
            End Select
        Next

        a1 = bingo(0, 0) + bingo(0, 1) + bingo(0, 2)
        a2 = bingo(1, 0) + bingo(1, 1) + bingo(1, 2)
        a3 = bingo(2, 0) + bingo(2, 1) + bingo(2, 2)

        a4 = bingo(0, 0) + bingo(1, 1) + bingo(2, 2)

        a5 = bingo(0, 2) + bingo(1, 2) + bingo(2, 2)
        a6 = bingo(0, 1) + bingo(1, 1) + bingo(2, 1)
        a7 = bingo(0, 0) + bingo(1, 0) + bingo(2, 0)

        a8 = bingo(2, 0) + bingo(1, 1) + bingo(0, 2)

        Dim ans() As Integer = New Integer(7) {a1, a2, a3, a4, a5, a6, a7, a8}

        If Array.IndexOf(ans, 3) <> -1 Then
            Console.WriteLine("Yes")
        Else
            Console.WriteLine("No")
        End If
    End Sub
End Module