The correct answer is - an elegy written by Walt Whitman mourning and praising Lincoln.
"O Captain! My Captain!" is an elegy (a sad poem/song written to praise/mourn someone who passed away) written by Walt Whitman because he wanted to celebrate the life and death of one of the most important American presidents, Lincoln.