main=mapM print[x|x<-[17..4^7],read%show x] r%(a:b)=b<" "||abs(r[a]-r[b!!0])>5&&r%b