Hamming using classes