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

let () =
  Scanf.scanf "%d" @@ fun n ->
  let s = Array.init n (fun _ -> Scanf.scanf " %s" parse) in
  Array.sort (fun (a, b) (c, d) -> d - b) s;
  let tp, tb =
    Array.fold_left (fun (tp, tb) (p, b) ->
      (tp + p, min tb (tp + b))) (0, 0) s in

  Printf.printf "%d %d\n" tp tb;
  let ans = if tp = 0 && tb >= 0 then "Yes" else "No" in
  print_endline ans