input: from typing import List, Dict
  
  def construct_mnist_model(layers: List[Dict]) -> keras.Model:
      """Construct a neural network model to classify the MNIST data set using given layers.
      Each layer in the list is a dictionary where the keys are 'type' (either 'input', 'hidden', or 'output'),
      'units' (number of units for 'hidden' or 'output' layer), and 'activation' (activation function).
      The 'input' layer does not require 'units' but must specify the 'shape' of the input data.
      The function should return the constructed keras model.
  
      Example:
      >>> layers = [
      ...     {'type': 'input', 'shape': (784,)},
      ...     {'type': 'hidden', 'units': 128, 'activation': 'relu'},
      ...     {'type': 'output', 'units': 10, 'activation': 'softmax'}
      ... ]
      >>> model = construct_mnist_model(layers)
      >>> model.compile(optimizer='adam', 
      ...               loss='sparse_categorical_crossentropy',
      ...               metrics=['accuracy'])
      >>> isinstance(model, keras.Model)
      True
      """
      input_layer = None
      previous_layer = None
      
      for layer in layers:
          if layer['type'] == 'input':
              input_layer = keras.layers.Input(shape=layer['shape'])
              previous_layer = input_layer
          elif layer['type'] == 'hidden':
              hidden_layer = keras.layers.Dense(units=layer['units'], 
                                                activation=layer['activation'])(previous_layer)
              previous_layer = hidden_layer
          elif layer['type'] == 'output':
              output_layer = keras.layers.Dense(units=layer['units'], 
                                                activation=layer['activation'])(previous_layer)
              previous_layer = output_layer
      
      model = keras.Model(inputs=input_layer, outputs=previous_layer)
      return model
output:     model = keras.Model(inputs=input_layer, outputs=previous_layer)
      return model