complexPairs :: String -> Bool
complexPairs = go empty
  where go :: Map String Int -> String -> Bool
        go m [x,y]
            | (Just _) <- val = True
          where (val, m') = insertLookupWithKey (\_ a _ -> a) [x,y] 1 m
        go m (x:y:z:xs)
            | (Just _) <- val = True
            | x == y && x == z  = go m' (  z:xs)
            | otherwise         = go m' (y:z:xs)
          where (val, m') = insertLookupWithKey (\_ a _ -> a) [x,y] 1 m
        go m _ = False
complexPairs :: String -> Bool
complexPairs = go empty
  where go :: Map String Int -> String -> Bool
        go m [x,y]
            | (Just _) <- val = True
          where (val, m') = insertLookupWithKey (\_ a _ -> a) [x,y] 1 m
        go m (x:y:z:xs)
            | (Just _) <- val = True
            | x == y && x == z  = go m' (  z:xs)
            | otherwise         = go m' (y:z:xs)
          where (val, m') = insertLookupWithKey (\_ a _ -> a) [x,y] 1 m
        go m _ = False
complexPairs = go empty
  where go :: Map String Int -> String -> Bool
        go m [x,y]
            | (Just _) <- val = True
          where (val, m') = insertLookupWithKey (\_ a _ -> a) [x,y] 1 m
        go m (x:y:z:xs)
            | (Just _) <- val = True
            | x == y && x == z  = go m' (  z:xs)
            | otherwise         = go m' (y:z:xs)
          where (val, m') = insertLookupWithKey (\_ a _ -> a) [x,y] 1 m
        go m _ = False