How did Angel Eyes and Tuco and Blondie knew each other?
When Tuco and Blondie arrived at the Union POW camp, they were lined up with other prisoners during roll call.
Tuco saw Angel Eyes and said to Blondie: "Hey, that's Angel Eyes".
How did they know each other?
Angel Eyes did see Tuco at the end of the rope during the 2nd hanging scam at the beginning at the movie and he also saw Blondie nearby on a horse with his rifle.
But unless there is a scene missing (or a scene that wasn't filmed) showing the three of them interacted with each other in that town prior to the 2nd hanging, there are no other parts in the movie prior to the POW camp showing that their 3 paths have crossed each other.
p.s. I've seen this movie over 2 dozen times including original Italian version in Italy, US version here on VHS, then Italian and US restored version and just now, the extended 2 hours and 58 min version.