14 lines
279 B
Python
14 lines
279 B
Python
for _ in range(int(input())) :
|
|
op,cl,ret = 0,0,'YES'
|
|
for c in input() :
|
|
if c=='(' :
|
|
op+=1
|
|
else :
|
|
cl+=1
|
|
if op<cl :
|
|
ret = 'NO'
|
|
break
|
|
if op-cl!=0 :
|
|
ret = 'NO'
|
|
print(ret)
|
|
|