On which team foul do bonus rules take factoring an NBA game quarter?

In the NBA, bonus rules take effect on the fifth team foul in each quarter. Once a team commits their fifth team foul in a quarter, the opposing team is awarded free throws for any subsequent fouls committed by the fouling team. This is known as being "in the bonus" or "shooting bonus" situation.