Naguib Mahfouz said this quote

At times people who are extremely sad become lighthearted for the most trivial reasons, merely to obtain the relief furnished by the exactly opposite condition.