#Import the NumPy library
import numpy as np
# create two matrices
A = np.array([[1, 2], [3, 4]])
B = np.array([[5, 6], [7, 8]])
# getting its dot product
dot_product = np.matmul(A, B)
# fetching the diagonal
diagonal = np.diag(dot_product)
#printing results
print(diagonal)