length = int(raw_input(""))
for i in range(length):
s = raw_input("")
myset = set(s)
if len(myset)<3:
print ‘Dynamic’
else:
count = []
for char in myset:
count.append(s.count(char))
flag = False
for v in count:
for j in count:
if v+j in count:
print ‘Dynamic’
flag = True
break
if flag:
break
else:
print ‘Not’
Please solution link instead whole solution