pure a = [a] -- pure is part of the standard library in GHC 7.10; Ideone uses the outdated GHC 7.8

f=any(all(\(a,b:c)->1>mod(a!!1-b)4).(zip=<<tail)).mapM((\a->[[a,a+1],[a+1,a]]).read.pure)

main = print $ map f ["1","1234","1221","3333","143332","22234","2234","22214","1221441","41233","13","1224","121","12221","43221"]
