In 1864, First Lieutenant John J. Dunbar is wounded in battle at St. David's Field in Tennessee. Choosing suicide in battle over amputation of his leg, he takes a horse and rides up to and along the Confederate front lines. Despite numerous pot shots, the Confederates fail to shoot him, and while they are distracted, the Union Army successfully attack the line. Dunbar survives, receives a citation for bravery, and proper medical care. He recovers fully and is awarded Cisco, the horse who carried him, and his choice of posting. Dunbar requests a transfer to the western frontier so he can see it before it disappears. Dunbar is transferred to Fort Hays, a large fort presided over by a mentally ill and suicidal major who despises Dunbar's enthusiasm, but agrees to post him to the furthest outpost they have, Fort Sedgewick, and kills himself shortly afterwards. Dunbar travels with Timmons, a mule wagon provisioner; they arrive to find the fort deserted and in poor condition. Despite the threat of nearby Indian tribes, Dunbar elects to stay and man the post himself. He begins rebuilding and restocking the fort and prefers the solitude afforded him, recording many of his observations in his diary. Timmons is killed by Pawnee Indians on the journey back to Ft. Hays; his death together with that of the major who had sent them there prevents other soldiers from knowing of Dunbar's assignment to Ft. Sedgewick, and no other soldiers arrive to reinforce the post.
Dunbar initially encounters his Sioux neighbors when attempts are made to steal his horse and intimidate him. Deciding that being a target is a poor prospect, he decides to seek out the Sioux camp himself and attempt dialogue, rather than wait. On his way he comes across Stands With A Fist, the white adopted daughter of the tribe's medicine man Kicking Bird, who is attempting suicide in mourning for her husband. Dunbar brings her back to the Sioux to recover, and some of the tribe begin to respect him. Eventually, Dunbar establishes a rapport with Kicking Bird and the warrior Wind In His Hair, initially visiting each other's camps. The language barrier frustrates them, and Stands With A Fist acts as interpreter, although only with difficulty remembering English from her early years before her family died during a Pawnee raid.
Dunbar finds that what he had been told of the tribe was generally untrue, and develops a growing respect and appreciation of their lifestyle and customs. Learning their language, he is accepted as an honored guest by the Sioux after he tells them of a migrating herd of buffalo and participates in the hunt. When at Fort Sedgewick, Dunbar also befriends a wolf he dubs "Two Socks" for its white forepaws. Observing Dunbar and Two Socks chasing each other, the Sioux give him the name "Dances With Wolves." During this time, Dunbar also forges a romantic relationship with Stands With A Fist and helps defend the village from an attack by the rival Pawnee tribe. Dunbar eventually wins Kicking Bird's approval to marry Stands With A Fist, and abandons Fort Sedgewick.
Because of the growing Pawnee and white threat, Chief Ten Bears decides to move the tribe to its winter camp. Dunbar decides to accompany them but must first retrieve his diary from Fort Sedgewick as he realizes that it would provide the army with the means to find the tribe. However, when he arrives he finds the fort reoccupied by the U.S. Army. Because of his Sioux clothing, the soldiers open fire, killing Cisco and capturing Dunbar, arresting him as a traitor. Senior officers interrogate him, but Dunbar cannot prove his story, as a corporal has found and discarded his diary. Having refused to serve as an interpreter to the tribes, Dunbar is charged with desertion and transported back east as a prisoner. Soldiers of the escort shoot Two Socks when the wolf attempts to follow Dunbar, despite Dunbar's attempts to intervene.
Eventually, the Sioux track the convoy, killing the soldiers and freeing Dunbar. They assert that they do not see him as a white man, but rather, as a Sioux called Dances With Wolves. At the winter camp, Dunbar decides to leave with Stands With A Fist, since his continuing presence will endanger the tribe. As they leave, Wind In His Hair shouts to Dunbar, reminding him that he is Dunbar's friend, a contrast to their original meeting where he shouted at Dunbar in hostility. U.S. troops are seen searching the mountains but are unable to locate them, while a lone wolf howls in the distance. An epilogue states that thirteen years later the last remnants of the free Sioux were subjugated to the American government, ending the conquest of the Western frontier states and the livelihoods of the tribes on the Great Plains.

Question: Where did Dunbar retrieve his diary?
Answer: Ft. Sedgewick