firstDuplicate (a:as)
  | a `elem` as = Just a
  | otherwise = firstDuplicate as
firstDuplicate (a:as)
  | a `elem` as = Just a
  | otherwise = firstDuplicate as
firstDuplicate (a:as)
  | a `elem` as = Just a
  | otherwise = firstDuplicate as