
module S = Set.Make(struct
  type t = int * int
  let compare (p, b) (q, d) = q - p
end)

let parse s =
  let arr = Array.init (String.length s) (fun i -> s.[i]) in
  Array.fold_left (fun (p, b) c ->
    if c = '(' then (p+1, b) else (p-1, min b (p-1))) (0, 0) arr

let solve () =
  Scanf.scanf "%d" @@ fun n ->
  let s = List.init n (fun _ -> Scanf.scanf " %s" parse) in

  let ls = s |> List.filter (fun (p, b) -> p >= 0) |> Array.of_list in
  let rs = s |> List.filter (fun (p, b) -> p < 0) |> Array.of_list in

  Array.sort (fun (p, b) (q, c) -> if b <> c then c-b else q-b) ls;
  Array.sort (fun (p, b) (q, c) -> if b-p <> c-q then (c-q) - (b-p) else q-p) rs;

  let pl, bl =
    Array.fold_left (fun (pl, bl) (p, b) -> (pl + p, min bl (pl + b))) (0, 0) ls in

  let pr, br =
    Array.fold_left (fun (pr, br) (p, b) -> (pr - p, min br (br + (b-p)))) (0, 0) rs in

  if min bl br = 0 && pl = pr then "Yes" else "No"

let () = solve () |> print_endline
