(* ocamlfind ocamlopt -package batteries -linkpkg main.ml -o a.out *) open Batteries 
let card = Array.init 3 
                ( fun _ -> 
                          Str.split (Str.regexp " ") (read_line ()) 
                          |> List.map int_of_string |> Array.of_list) 

let blst = Scanf.sscanf (read_line ()) "%d" 
                ( fun n -> 
                          List.init n (
                                  fun _ -> 
                                          Scanf.sscanf (read_line ()) "%d" (
                                                  fun n -> 
                                                          n
                                          )
                          )
                )

let carray = Array.make_matrix 3 3 false

let () =
        Array.iteri (fun i ie ->
                Array.iteri (fun j je ->
                        let exists = List.exists (fun a ->
                                a = je
                        ) blst in
                                if exists then
                                        carray.(i).(j) <- true
                                else
                                        carray.(i).(j) <- false
                ) ie
        ) card

let () = 
        let ans = 
                if carray.(0) = [| true; true; true |] ||
                   carray.(1) = [| true; true; true |] ||
                   carray.(2) = [| true; true; true |] ||
                   Array.init 3 (fun i ->
                           carray.(i).(0)
                   ) = [| true; true; true |] ||
                   Array.init 3 (fun i ->
                           carray.(i).(1)
                   ) = [| true; true; true |] ||
                   Array.init 3 (fun i ->
                           carray.(i).(2)
                   ) = [| true; true; true |] ||
                   Array.init 3 (fun i ->
                           carray.(i).(i)
                   ) = [| true; true; true |] ||
                   Array.init 3 (fun i ->
                           carray.(2 - i).(i)
                   ) = [| true; true; true |]
                then
                        "Yes"
                else
                        "No" 
        in Printf.printf "%s\n" ans
