Let x be the principal of the first loan, and y be the principal of the second loan, then, we can set the following system of equations:

Solving the first equation for x, we get:

Substituting the above result in the second equation, we get:

Solving the above equation for y, we get:

Substituting y=5000, in x=12,000-y, we get:

Answer:
The principal of the 8% interest loan was $5000, and the principal of the other loan was $7000.