As they are oriented in the picture.
The 2 ports on the top go to the master cylinder.
The 2 ports on the left are left and right front brakes
the larger port to the right goes to the back brakes.
the "sensor" hooks to the brake light in your dash. It lets you know if you have a potential problem with your front to rear brakes. (ie: a leaking or broken line/caliper/wheel cylinder)