Hi @geek_geek,

Only place i can see the posibility of error is using of del on the list on lines 38 and 43.

So try like this,

```
# your code goes here
def isval(s):
xy = 0
for i in s:
if(i=='('):
xy+=1
else:
xy-=1
if(xy<0):
return -1
if(xy==0):
return 1
else:
return -1
def prog():
s = raw_input()
#print "##",s
k = input()
if(isval(s)==-1):
if(k==1):
print s
else:
print -1
else:
nu = 0
l=len(s)
s=list(s)
wan = []
for i in xrange(l-1):
if(s[i]=='(' and s[i+1]==')'):
nu+=2
wan+=[(i,i+1)]
if(k>nu):
print -1
elif(k>(nu/2)):
k-=(nu/2)
k-=1
x=wan[-1::-1][k][0]
del s[x]
print "".join(s)
else:
k-=1
x=wan[k][1]
del s[x]
print "".join(s)
t = input()
for _ in xrange(t):
try:
prog()
except Exception:
pass
```

If the solution doesn’t give NZEC, proramatically it wouldn’t throw NZEC, then we can focus on ‘del’ part try to handle it in different way if length of list greater than w then delete that element.