

















def     process(tab, first, end):

    #print(tab)

    #print(first, end)

    total = first

    for i in tab:

        if (i[1] > total):

            return ("No")

        total += i[0]

        if (total < 0):

            return ("No")

    if (total == end):

        return ("Yes")

    return ("No")









N  = int(eval(input()))



first = 0

last = 0

clean = 0

tab = []

total = 0

for i in range(N):

    s = eval(input())

    avant = 0

    apres = 0

    for j in s:

        if (j == '('):

            apres += 1

        elif (j == ')'):

            if (apres > 0):

                apres -= 1

            else:

                avant += 1

    if (avant == 0 and apres > 0):

        first += apres

    elif (apres == 0 and avant > 0):

        last += avant

    elif (avant > 0 or apres > 0):

        tab.append((apres - avant, avant, apres, s))

    else:

        clean += 1

    total += avant - apres

if (first == -1 and clean > 0):

    first = 0

    clean -= 1

if (last == -1 and clean > 0):

    last = 0





tab = sorted(tab)

tab = tab[::-1]

if (total == 0 and first > -1 and last > -1):

    res = process(tab, first, last)

else:

    if (total == 0 and N == 1):

        res = "Yes"

    else:

        res = "No"

print(res)

# **************************************************************************** #

#                                                                              #

#                                            __   __ .____  .__  __.  ____     #

#    F-bracketSequencing.py                 |  | |  ||  _ \ |  \/  | /    |    #

#                                           |  | |  || |_| || \  / ||  ,--'    #

#    By: ayahyao <y.anas1997@gmail.com>     |  | |  ||  __/ | |\/| ||  |       #

#                                           |  `-'  || |    | |  | ||  `--.    #

#    Created: 2020/05/10 18:38 by Anas       \_____/ |_|    |_|  |_| \____|    #

#    Updated: 2020/05/10 18:42 by Anas                                         #

#                                                                              #

# **************************************************************************** #



def     process(tab, beginning, end):

    total = beginning

    for i in tab:

        if (i[1] > total or total + i[0] < 0):

            return ("No")

        total += i[0]

    if (total == end):

        return ("Yes")

    return ("No")



def     parsing(N):

    beginning, ending = 0,0

    clean = 0

    total = 0

    tab = []



    for i in range(N):

        s = eval(input())

        before, after = 0, 0

        for j in s:

            if (j == '('):

                after += 1

            elif (j == ')'):

                if (after > 0):

                    after -= 1

                else:

                    before += 1

        if (before == 0 and after > 0):

            beginning += after

        elif (after == 0 and before > 0):

            ending += before

        elif (before > 0 or after > 0):

            tab.append((after - before, before, after))

        else:

            clean += 1

        total += before - after

    tab = sorted(tab)[::-1]

    return tab, total, beginning, ending, clean





N  = int(eval(input()))

tab, total, beginning, ending, clean = parsing(N)

if (total == 0 and N == 1):

    res = "Yes"

elif ((total != 0) or ((min(beginning, ending) == 0 and clean == 0) 

                 or (max(beginning, ending) == 0 and clean == 1))):

    res = "No"

else:

    res = process(tab, beginning, ending)

print(res)

def process(tab, first, end):
    # print(tab)
    # print(first, end)
    total = first
    for i in tab:
        if i[1] > total:
            return "No"
        total += i[0]
        if total < 0:
            return "No"
    if total == end:
        return "Yes"
    return "No"


N = int(eval(input()))
first = 0
last = 0
clean = 0
tab = []
total = 0
for i in range(N):
    s = eval(input())
    avant = 0
    apres = 0
    for j in s:
        if j == "(":
            apres += 1
        elif j == ")":
            if apres > 0:
                apres -= 1
            else:
                avant += 1
    if avant == 0 and apres > 0:
        first += apres
    elif apres == 0 and avant > 0:
        last += avant
    elif avant > 0 or apres > 0:
        tab.append((apres - avant, avant, apres, s))
    else:
        clean += 1
    total += avant - apres
if first == -1 and clean > 0:
    first = 0
    clean -= 1
if last == -1 and clean > 0:
    last = 0
tab = sorted(tab)
tab = tab[::-1]
if total == 0 and first > -1 and last > -1:
    res = process(tab, first, last)
else:
    if total == 0 and N == 1:
        res = "Yes"
    else:
        res = "No"
print(res)

# **************************************************************************** #
#                                                                              #
#                                            __   __ .____  .__  __.  ____     #
#    F-bracketSequencing.py                 |  | |  ||  _ \ |  \/  | /    |    #
#                                           |  | |  || |_| || \  / ||  ,--'    #
#    By: ayahyao <y.anas1997@gmail.com>     |  | |  ||  __/ | |\/| ||  |       #
#                                           |  `-'  || |    | |  | ||  `--.    #
#    Created: 2020/05/10 18:38 by Anas       \_____/ |_|    |_|  |_| \____|    #
#    Updated: 2020/05/10 18:42 by Anas                                         #
#                                                                              #
# **************************************************************************** #
def process(tab, beginning, end):
    total = beginning
    for i in tab:
        if i[1] > total or total + i[0] < 0:
            return "No"
        total += i[0]
    if total == end:
        return "Yes"
    return "No"


def parsing(N):
    beginning, ending = 0, 0
    clean = 0
    total = 0
    tab = []
    for i in range(N):
        s = eval(input())
        before, after = 0, 0
        for j in s:
            if j == "(":
                after += 1
            elif j == ")":
                if after > 0:
                    after -= 1
                else:
                    before += 1
        if before == 0 and after > 0:
            beginning += after
        elif after == 0 and before > 0:
            ending += before
        elif before > 0 or after > 0:
            tab.append((after - before, before, after))
        else:
            clean += 1
        total += before - after
    tab = sorted(tab)[::-1]
    return tab, total, beginning, ending, clean


N = int(eval(input()))
tab, total, beginning, ending, clean = parsing(N)
if total == 0 and N == 1:
    res = "Yes"
elif (total != 0) or (
    (min(beginning, ending) == 0 and clean == 0)
    or (max(beginning, ending) == 0 and clean == 1)
):
    res = "No"
else:
    res = process(tab, beginning, ending)
print(res)

-def process(tab, first, end): -    # print(tab) -    # print(first, end) -    total = first +# **************************************************************************** # +#                                                                              # +#                                            __   __ .____  .__  __.  ____     # +#    F-bracketSequencing.py                 |  | |  ||  _ \ |  \/  | /    |    # +#                                           |  | |  || |_| || \  / ||  ,--'    # +#    By: ayahyao <y.anas1997@gmail.com>     |  | |  ||  __/ | |\/| ||  |       # +#                                           |  `-'  || |    | |  | ||  `--.    # +#    Created: 2020/05/10 18:38 by Anas       \_____/ |_|    |_|  |_| \____|    # +#    Updated: 2020/05/10 18:42 by Anas                                         # +#                                                                              # +# **************************************************************************** # +def process(tab, beginning, end): +    total = beginning -        if i[1] > total: +        if i[1] > total or total + i[0] < 0: -        if total < 0: -            return "No" +def parsing(N): +    beginning, ending = 0, 0 +    clean = 0 +    total = 0 +    tab = [] +    for i in range(N): +        s = eval(input()) +        before, after = 0, 0 +        for j in s: +            if j == "(": +                after += 1 +            elif j == ")": +                if after > 0: +                    after -= 1 +                else: +                    before += 1 +        if before == 0 and after > 0: +            beginning += after +        elif after == 0 and before > 0: +            ending += before +        elif before > 0 or after > 0: +            tab.append((after - before, before, after)) +        else: +            clean += 1 +        total += before - after +    tab = sorted(tab)[::-1] +    return tab, total, beginning, ending, clean + + -first = 0 -last = 0 -clean = 0 -tab = [] -total = 0 -for i in range(N): -    s = eval(input()) -    avant = 0 -    apres = 0 -    for j in s: -        if j == "(": -            apres += 1 -        elif j == ")": -            if apres > 0: -                apres -= 1 -            else: -                avant += 1 -    if avant == 0 and apres > 0: -        first += apres -    elif apres == 0 and avant > 0: -        last += avant -    elif avant > 0 or apres > 0: -        tab.append((apres - avant, avant, apres, s)) -    else: -        clean += 1 -    total += avant - apres -if first == -1 and clean > 0: -    first = 0 -    clean -= 1 -if last == -1 and clean > 0: -    last = 0 -tab = sorted(tab) -tab = tab[::-1] -if total == 0 and first > -1 and last > -1: -    res = process(tab, first, last) +tab, total, beginning, ending, clean = parsing(N) +if total == 0 and N == 1: +    res = "Yes" +elif (total != 0) or ( +    (min(beginning, ending) == 0 and clean == 0) +    or (max(beginning, ending) == 0 and clean == 1) +): +    res = "No" -    if total == 0 and N == 1: -        res = "Yes" -    else: -        res = "No" +    res = process(tab, beginning, ending)