input: def find_mode(values: List[int]) -> int:
      """Find the mode of the given set of values, which is the value that appears most frequently.
      If there are multiple values with the same frequency, returns the first one encountered.
      >>> find_mode([1, 2, 3, 2, 4, 2])
      2
      """
output:     frequency = {}
      for value in values:
          if value in frequency:
              frequency[value] += 1
          else:
              frequency[value] = 1
      
      max_freq = 0
      mode = None
      for value, freq in frequency.items():
          if freq > max_freq:
              max_freq = freq
              mode = value
      
      return mode