What is considered more haram, masturbation for men or men having friendship with a woman?

Please give a clear answer, I need to know specifically which is deemed worse

Both are haram