The "best" is way overengineered. I doubt this error-handling will even work. If the program fails to print "hello world" using puts then it is very likely to fail on fprintf to stderr.
If they're both not writable, or stderr is writable but writing fails anyway, there's nothing we can do about it anyway, but that does not make it any less proper to try.