input: Write a python function to build and train a fully-connected neural network using the MNIST dataset.
  assert build_and_train_nn_model() is not None
output: def build_and_train_nn_model():
      import tensorflow as tf
      from tensorflow.keras.datasets import mnist
      from tensorflow.keras.models import Sequential
      from tensorflow.keras.layers import Dense, Flatten
      from tensorflow.keras.utils import to_categorical
  
      # Load the MNIST dataset
      (x_train, y_train), (x_test, y_test) = mnist.load_data()
  
      # Normalize the data
      x_train = x_train / 255.0
      x_test = x_test / 255.0
  
      # One-hot encode the labels
      y_train = to_categorical(y_train, 10)
      y_test = to_categorical(y_test, 10)
  
      # Build the neural network model
      model = Sequential([
          Flatten(input_shape=(28, 28)),
          Dense(128, activation='relu'),
          Dense(64, activation='relu'),
          Dense(10, activation='softmax')
      ])
  
      # Compile the model
      model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])
  
      # Train the model
      model.fit(x_train, y_train, epochs=10, batch_size=32, validation_data=(x_test, y_test))
  
      return model