let () = Scanf.scanf "%d\n" @@ fun n ->
  let ss =
    Array.init n @@ fun _ ->
      Scanf.scanf "%s\n" @@ fun s ->
        Array.fold_left (fun (m, c) -> function
          | '(' -> (m, c + 1)
          | ')' -> (min m (c - 1), c - 1)) (0, 0) @@
        Array.init (String.length s) (String.get s) in
  print_endline @@
  if
    ( <> ) 0 @@
    Array.fold_right (fun (_, c) -> ( + ) c) ss 0
  then "No"
  else begin
    Array.sort (fun (m, c) (m', c') -> compare (m', c') (m, c)) ss;
    try
      ignore
      (Array.fold_left (fun x (m, c) ->
        if x + m < 0 || x + c < 0 then raise Not_found; x + c) 0 ss);
      "Yes"
    with Not_found -> "No"
  end

