The phrase 'to a tee' is used relatively frequently in modern English, meaning something is perfect or exact in relation to something else. For example, you may be able to mimic someone's accent to a tee. But what exactly is the 'tee' referring to?
Strangely, the phrase has roots that stretch right back into the 1600s - it was first recorded in 1693. Yet its history goes either further back to the Romans and the Greeks. The ancient Greeks and Romans started to use the the letter 'I' figuratively to mean 'the least part of anything'. This was because the letter 'I' was called 'Iota' - the smallest letter of the alphabet. This is where we get today's expressions which contain the word 'iota' - for example, 'you have not got an iota of proof he committed the crime', meaning you haven't got the smallest proof required.
However, there was another phrase the Greeks and Romans used: 'not to give a jot or a tittle'. As I tweeted recently, a 'tittle' is the name for the dot above a lower case 'i' or 'j'. As so often is the case with English, over time the phrase 'to a tittle' has been shortened to what we know today as 'to a tee'. The idea is that something is so alike to something else it requires little thought and mimics something perfectly.