Kirchhoffs rules the branch theorem and the loop theorem