Role of cognitive shift in resilient adaptation to difficult events