let () =
    let main () =
        let ar = Array.make 101 1024 in
        for i = 0 to 8 do
            Scanf.scanf " %d" (fun a -> ar.(a) <- 1 lsl i)
        done;
        let n = Scanf.scanf " %d" (fun n -> n) in
        let rec loop i map =
            if i = 0 then map else
                let b = Scanf.scanf " %d" (fun b -> b) in
                loop (i - 1) (map lor ar.(b))
        in
        let m = loop n 0 in
        let l = [
            (1 lsl 0) lor (1 lsl 1) lor (1 lsl 2) ;
            (1 lsl 3) lor (1 lsl 4) lor (1 lsl 5) ;
            (1 lsl 6) lor (1 lsl 7) lor (1 lsl 8) ;
            (1 lsl 0) lor (1 lsl 3) lor (1 lsl 6) ;
            (1 lsl 1) lor (1 lsl 4) lor (1 lsl 7) ;
            (1 lsl 2) lor (1 lsl 5) lor (1 lsl 8) ;
            (1 lsl 0) lor (1 lsl 4) lor (1 lsl 8) ;
            (1 lsl 2) lor (1 lsl 4) lor (1 lsl 6)
        ] 
        in
        print_endline (if List.exists (fun a -> a land m = a) l then "Yes" else "No")
    in
    main ()