let rec fix f x = f (fix f) x;;
Scanf.(Array.(
  let e = make 4 [] in
  init 3 (fun i ->
    scanf " %d %d" @@ fun u v -> (
      let u,v = u-1,v-1 in
      e.(u) <- (v,i) :: e.(u);
      e.(v) <- (u,i) :: e.(v)
    )
  ) |> ignore;
  init 3 (fun i ->
    fix (fun f count v a ->
      if count=3 then (
        if fold_left (&&) true a then
          (print_string "YES"; exit 0)
      ) else (
        List.iter (fun (w,i) ->
          if not a.(i) then (
            a.(i) <- true;
            f (count+1) w a;
            a.(i) <- false;
          )
        ) e.(v)
      )
    ) 0 i @@ make 3 false
  ) |> ignore;
  print_string "NO"
))