TEA: Tea stains the dental plaque that sits on your teeth. If the plaque isn't brush away, that can penetrate deep into your teeth and discolor them directly, leading to an ugly yellow color.
SMOKING: The nicotine and tar in cigarettes slowly build up on your teeth over time, allowing the yellow color to slowly seep below the surface and stain teeth. The longer you smoke, the more you'll see that ugly yellow color.
COFFEE: It's not the dark color of coffee that causes teeth to stain, but rather other factors like caffeine and the roughness of the beverage on your enamel. This allows the color from the coffee to penetrate below the surface, causing the ugly yellow color.