In 1837, Augustus attempted to obtain an appointment for his nephew to the United States Military Academy, but the vacancy for his congressional district had already been filled. Therefore, Longstreet was appointed in 1838 by a relative, Reuben Chapman, who represented the First District of Alabama, where Mary Longstreet lived. Longstreet was a poor student. By his own admission in his memoirs, he "had more interest in the school of the soldier, horsemanship, exercise, and the outside game of foot-ball than in the academic courses". He ranked in the bottom third of every subject during his four years at the academy. In January of his third year, Longstreet initially failed his mechanics exam, but took a second test two days later and passed. Longstreet's engineering instructor in his fourth year was Dennis Hart Mahan, a man who stressed swift maneuvering, protection of interior lines, and positioning troops in strategic points rather than attempting to destroy the enemy's army outright. Although Longstreet earned modest grades in the course, his behavior during the Civil War followed similar tactics. In the end, Longstreet ranked 54th out of 56 cadets when he graduated in 1842.