input: Write a python function to create and train a neural network model using TensorFlow and Keras for a given dataset.
  assert create_and_train_model([[1,2], [2,4], [4,2], [2,1], [4,4], [3,3], [3,1], [1,3]], [0,0,1,1,2,2,3,3]).history['accuracy'][-1] > 0.5
output: def create_and_train_model(X, y):
      import tensorflow as tf
      from tensorflow.keras.models import Sequential
      from tensorflow.keras.layers import Dense
      from tensorflow.keras.utils import to_categorical
      from sklearn.model_selection import train_test_split
  
      # One-hot encode the labels
      y = to_categorical(y)
  
      # Split the data into train and test sets
      X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
  
      # Create a simple neural network model
      model = Sequential()
      model.add(Dense(8, input_dim=len(X[0]), activation='relu'))
      model.add(Dense(4, activation='softmax'))
  
      # Compile the model
      model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])
  
      # Train the model
      history = model.fit(X_train, y_train, epochs=50, batch_size=1, verbose=0)
  
      # Evaluate the model
      _, accuracy = model.evaluate(X_test, y_test, verbose=0)
  
      return history