Macedonia can join NATO and EU after end to name dispute