Even when you use sort, there are tricks you can use to maintain the input order.
Code:
test@ws1:/tmp$ cat input.txt
4 ZZZ
1 ABC
1 DEF
1 MNO
2 PQR
2 UVW
3 XYZ
4 CCC
test@ws1:/tmp$ cat -n input.txt | sort -u -k 2,2 | sort -k 1n | cut -f2
4 ZZZ
1 ABC
2 PQR
3 XYZ
test@ws1:/tmp$