To be or not to be is from what Shakespeare play?

The play Hamlet, it's part of a soliloquy spoken by Hamlet about whether or not he should commit suicide. (To be or not to be=To live or not to live)