I'm trying to buy a phone off ebay tht is either an iphone 5 5c or 5s?

I wanted to know if the iphone 5 has a sim card slot because i have a tmobile sim card and i want to know besides tmobile on what other carrier will it work on as well. Or can i jus buy an iphone 5 that says unlocked and will ot still work?

If it is unlcoked it should work with most to all carriers! Hope i helped!