Accounting for a Factory overhead using a T-account.

How do you account for factory overhead using a T-account and how do you account for the balance in the account at the end of the year?

What is the difference between permanent accounts and temporary accounts, and why does an accounting system have both types of accounts?