The Cossacks is believed to be somewhat autobiographical, partially based on Tolstoy's experiences in the Caucasus during the last stages of the Caucasian War. Tolstoy had a morally corrupt experience in his youth, engaging in numerous promiscuous partners, heavy drinking and gambling problems; many argue Tolstoy used his own past as inspiration for the protagonist Olenin.
Disenchanted with his privileged life in Russian society, nobleman Dmitri Olenin joins the army as a cadet, in the hopes of escaping the superficiality of his daily life. On a quest to find "completeness," he naively hopes to find serenity among the "simple" people of the Caucasus. In an attempt to immerse himself in the local culture, he befriends an old man. They drink wine, curse, and hunt pheasant and boar in the Cossack tradition, and Olenin even begins to dress in the manner of a Cossack. He forgets himself and falls in love with the young Maryanka, in spite of her fianc  Lukashka. While spending life as a Cossack, he learns lessons about his own inner life, moral philosophy, and the nature of reality. He also understands the intricacies of human psychology and nature.The young idealist Dmitriy Olenin leaves Moscow, hoping to start a new life in the Caucasus. In the stanitsa, he slowly becomes enamored by the surroundings and despises his previous existence. He befriends the old Cossack Eroshka, who goes hunting with him and finds him a good fellow because of his propensity to drinking. During this time, young Cossack Luka kills a Chechen who is trying to come across the river towards the village to scout the Cossacks and in this way gains much respect. Olenin falls in love with the maid Maryanka, who is to be wed to Luka later in the story. He tries to stop this emotion and eventually convinces himself that he loves both Luka and Maryanka for their simplicity and decides that happiness can only come to a man who constantly gives to others with no thought of self-gratification.
He first gives an extra horse to Luka, who accepts the present yet doesn't trust Olenin on his motives. As time goes on, however, though he gains the respect of the local villagers, another Russian named Beletsky, who is still attached to the ways of Moscow, comes and partially corrupts Olenin's ideals and convinces him through his actions to attempt to win Maryanka's love. Olenin approaches her several times and Luka hears about this from a Cossack, and thus does not invite Olenin to the betrothal party. Olenin spends the night with Eroshka but soon decides that he will not give up on the girl and attempts to win her heart again. He eventually, in a moment of passion, asks her to marry him, which she says she will answer soon.
Luka, however, is severely wounded when he and a group of Cossacks go to confront a group of Chechens who are trying to attack the village, including the brother of the man he killed earlier. Though the Chechens lose after the Cossacks take a cart to block their bullets, the brother of the slain Chechen manages to shoot Luka in the belly when he is close by. As Luka seems to be dying and is being cared for by village people, Olenin approaches Maryanka to ask her to marry him; she angrily refuses. He realizes that "his first impression of this woman's inaccessibility had been perfectly correct." He asks his company commander to leave and join the staff. He says goodbye to Eroshka, who is the only villager who sees him off. Eroshka is emotional towards Olenin but after Olenin takes off and looks back, he sees that Eroshka has apparently already forgotten about him and has gotten back to normal life.
Output: What characteristic about Luka and Maryanka did Olenin love them both for?