Gianluca Gorni, thank you very much for your help, with the solution that gave me it solved my problem, that's what I needed.
Greetings Luis Ledesma :)
Try writing x =!= y (UnsameQ) instead of x != y (Unequal).
x =!= y
x != y