John can paint a fence by himself in 12 hours, while his friend Sam can paint the same fence in 8 hours. If they work together, how long will it take them to paint the fence? Let's think step by step and output the final answer within \boxed{}.
user