Implement K-nearest neighbors classification using Euclidean distance, majority voting, and deterministic tie-breaking.