nom="test1"
file=open(nom,'r')
temp=file.readlines()
file.close()
out=[]
for x in temp:
	out.append(x)
file=open('test_out','w')
for x in temp:
	if len(x)>4:
		for i in range(out.count(x)-1):
			out.remove(x)
temp=[]
S=[]
index=range(len(out))
for i in index:
	if i>1:
		print i
		print out[i]
		print len(out[i])
		if len(out[i])<4:
			temp=out[i+1:i+int(out[i])]		 
			while len(temp)>10:
				flag=True
				A=[]
				for x in temp:
					if flag:
						A.append(x)
					flag=not(flag)
				temp=A
				
			S.extend(temp)
for x in S:
	file.write(x)
file.close()
