def bracket_check(a):
    i = 0
    for j in a:
        if '(' == j:
            i += 1
        elif ')' == j:
            i -= 1
        if i == -1:
            break
    if i == 0:
        print('yes')
    else:
        print('no')


bracket_check('(())))')

90bd8c7bc2ed63dcdc61a19c631d1bf1905e6fdb
<mask token>

def bracket_check(a):
    i = 0
    for j in a:
        if '(' == j:
            i += 1
        elif ')' == j:
            i -= 1
        if i == -1:
            break
    if i == 0:
        print('yes')
    else:
        print('no')


<mask token>

def bracket_check(a):
    i = 0
    for j in a:
        if '(' == j:
            i += 1
        elif ')' == j:
            i -= 1
        if i == -1:
            break
    if i == 0:
        print('yes')
    else:
        print('no')


bracket_check('(())))')
