How to wire a lamp to a junction box?
First recommendation; put labels on stuff.  Sorry, nobody needs a Monday Morning Quarterback.

Do you have a meter?  I would try metering out which wire gets voltage with the lightswitch going on and off.

My guess, based on the two way switch, is that the three black wires are; Line ( from the breaker ), feed to the outlet, and feed to the switch.   The two whites in the wirenut would be the Neutral to the breaker box, and the outlet.  I am guessing that the single white wire is a carrier from the switch, or in your case, switches.  With this premise in mind I would check the voltage with a meter on the single white against ground while blinking the switch.  If the meter blinks with the switch, then put the fixture black onto this wire, and white with the wirenuted whites.

If this guess is wrong, I have more questions.  Did / does the outlet loose power when the lightswitch is off?  If yes, then it's probably wired with all blacks together and all whites together.  But again, I'd check with a meter before closing in all the boxes.

good luck, let us know the outcome