e=[]:e x%y|x>y=foldr(zipWith(:))e$y%x|y>x=x%x++(map succ<$>x%(y-x))|r<-[1..x]='a'<$r<$r f(a:b:_:c)=unlines$read[a,b]%read c main=interact f