The film begins in 1874 at the height of Imperial Russia. It starts at the house of Prince Stepan "Stiva" Oblonsky (Matthew Macfadyen) in Moscow. His wife, Princess Daria "Dolly" (Kelly Macdonald), catches Stiva and the governess of their five children having sex in a closet, having found the governess' note to her husband. Dolly tearfully banishes Stiva out of the home, forbidding him to ever see her or their children again.Stiva's sister, Anna Karenina (Keira Knightley), journeys to Moscow. Anna is a wealthy, well-liked socialite who lives in St. Petersburg with her older husband Alexi Karenin (Jude Law), a Russian statesman, and their son Serozha. She has arrived at her brother's request to attempt to convince Dolly to forgive Stiva. Karenin allowed her to leave but warns her about fixing the problems of others. Anna ignores this and goes to Moscow anyway, leaving behind her son Serozha who wants her to stay.Meanwhile, Stiva meets his old friend Konstatin Dimitrivich Levin (Domhnall Gleeson), a wealthy land owner in the country. Levin is looked down on by most of Moscow's elite society due to his distaste for city living. Levin professes his love to Stiva's sister-in-law, Katerina "Kitty" Alexandrovna Shcherbatsky (Alicia Vikander), and Stiva encourages him to propose to Kitty. However, Kitty declines his offer. It is later implied that she refused Levin's offer because she would rather marry Count Alexi Vronsky (Aaron Taylor-Johnson), which would make her a wealthy Countess socialite like Anna.Anna, while on a train to Moscow, meets Vronsky's mother, Countess Vronskaya (Olivia Williams), known throughout Russia as an adulteress. Levin meets up with his elder brother Nikolai (David Wilmot), who, like Levin, is an aristocrat, but has given up his inheritance to live the life of a wastrel. Nikolai lives with a prostitute named Masha whom he has taken as his wife and suggests to Levin that he should marry one of the peasants working at his estate. Levin then returns to his country estate in Pokrovskoe.Anna arrives in Moscow and meets Count Vronsky, and they have an immediate and mutual attraction. As they prepare to leave, a railroad worker is caught beneath train tracks and is violently killed. Vronsky, to impress Anna, decides to give money to the deceased man's family.Anna convinces Dolly to take Stiva back. At a ball that night, Kitty is radiant and dances with many aristocratic men. As Kitty must dance with the officers and gentlemen who have filled her dance card, she attempts to dance with Vronsky but he prefers to dance with Anna. Their attraction is noticed by everyone, including an upset Kitty; Anna notices this, and decides to leave the ball, feeling she has upstaged Kitty. Anna boards a train bound back to St. Petersburg, but at a rest stop notices Vronsky, who declares that he must be where she is at every moment. She tells him to go back to Moscow, but he refuses, saying he cannot and will follow her anyway.In St. Petersburg, Vronsky visits his friends along with his cousin Princess Betsy Tverskaya (Ruth Wilson) who is mutual friends with Anna and Karenin. Vronsky begins to show up at all the places Anna and Betsy visit; Anna is clearly amused, but also ashamed because now all of her high society friends are starting to notice their attraction. During a party held by Betsy, Vronsky believes Anna to have not attended due to him and leaves the party, only to miss Anna, who arrives late. Betsy informs Anna that Vronsky has left, so she need not worry about a scandal. However, Vronsky returns and starts to flirt with Anna openly. The party guests gossip behind their backs, which soon catches Karenin's attention; He suggests they go home at once, but Anna decides to stay. Vronsky threatens to take a promotion in another city but Anna requests that he stay. Anna arrives home and speaks with her husband about Vronsky. She denies there is any attraction, convinces him of her innocence and they go to bed. The next day Anna and Vronsky meet at a hotel and make love.Back at Levin's country estate, Stiva visits, where he tells Levin that Kitty and Vronsky are no longer getting married. Still heartbroken, Levin has decided to give up on love and instead focus on living an authentic country life. He plows his fields with his workers and has thoughts of taking one of his workers' daughters as his wife, like his brother had suggested.Karenin hears word that both his wife and her lover are in the country and decides to surprise her there at his country estate. Anna reveals to Vronsky that she is pregnant and she wishes to be his and only his. While retreating back to her country house she encounters Karenin who suggests he join her for the horse races that evening. All of Russian society is at the races, and Anna sits with the elite. Countress Vronskaya, upon hearing the rumors of her son and Anna, gives Anna a disgusted look and instead gives her attention to the young Princess Sorokina (Cara Delevingne). The races begin and Karenin notices Anna acting oddly whenever Vronsky is racing. Anna unintentionally airs her feelings for Vronsky publicly when his horse collapses and is injured and she overreacts. On their way home Anna confesses to Karenin that she is indeed Vronsky's mistress and wishes to divorce him. Because of St. Petersburg's conservative-hypocritical elite, and the fact that divorce in Russia calls for public humiliation for either one of the spouses, he refuses and instead has her confined to their house to keep up appearances. Vronsky demands she gets a divorce from her husband and Anna, despite knowing the difficulties, says they will find a way. (In old Russian tradition, divorces can only occur if one of the spouses disappear for a long time or if either one is cheating; if divorce is for the latter reason, the innocent spouse must show proof of the other spouse's infidelity. The unfaithful spouse, once divorced, will not be allowed to keep custody of any child she/he had had with the first spouse and will not be allowed to marry a second time.)As Levin is plowing his field one morning he sees a carriage with Kitty, and returns to Moscow to insist to Stiva that he must marry her. Anna, starting to show her pregnancy, receives Vronsky at her house in St. Petersburg, and berates him and curses him for not coming to her sooner. Vronsky, shocked at this new temper in Anna, replies only that he was doing his duties as an Officer. Soon Karenin comes back home to find out that Vronsky has been visiting Anna though he was forbidden to be in the house or near his wife.He searches Anna's desk and finds love letters. Now with evidence of Anna's infidelity, he declares that he will divorce her, keep their son, and drive her out into the street. Anna begs for her son to be with her, but Karenin enraged with anger shouts out that he would never allow his son be with an adulteress mother. Meanwhile, Levin and Kitty are reunited at the Oblonsky house for dinner. There, Karenin arrives to give news that he is divorcing Anna, much to the dismay of Stiva and Dolly. Anna begs Karenin to forgive her, but Karenin has made up his mind, even though it is obvious that he still loves Anna. After the dinner, Levin and Kitty confess their love to each other and eventually marry.Karenin gets a note that Anna has gone into premature labor and is dying. Karenin tears the card and returns home. As Anna lies dying, Karenin sees that she has confessed her sins before God and that she was in the wrong. Vronsky is there at her side, and she again berates him and tells him that he could never be the man Karenin is. Karenin feeling ashamed at how he has treated Anna, begs for her forgiveness. Anna forgives him.The next day Vronsky leaves at the request of Karenin. Karenin forms an attachment to Anna's baby Anya. He cradles her and watches over as if she was his child. Princess Betsy calls on Anna and discusses with her what will happen to Vronsky now that he has left St. Petersburg and has gone back to Moscow. Anna notices that Karenin is in the doorway and invites him in. She tells Betsy to tell Karenin everything she has told her.Karenin comes back to see Anna in tears and in rage. Anna tells him that she wished she would have died instead now she has to live with Karenin and still hear about and see Vronsky wherever she goes, and even more so with her bastard daughter from him. Karenin assures her that they will indeed be happy together again, but Anna only wants Vronsky. Karenin still does not agree to a divorce but releases Anna from her confinement. Anna informs Vronsky through a telegraph and the two leave to Italy along with little Anya. Levin and Kitty return to Levin's country estate where all his servants and attendees are enchanted with his new wife.Levin's maid informs him that Nikolai and his wife Masha are in the country and seek solitude because Nikolai is sick and will probably not live much longer. Having told Kitty about his brother and the situation with his wife Masha, Levin feels Kitty will be alarmed and outraged. However he is mistaken and Kitty dutifully asks that his brother and wife and join them in their country estate and that she will nurse him. Levin is shocked but he starts to notice that she has indeed grown up and is living for others instead of herself.Word has gotten to Countess Lydia that Anna and Vronsky have returned to St. Petersburg. Anna writes Countess Lydia to see if she can intervene so that she may see Serozha for his birthday. Anna wakes her son to professes her love for him and that she was wrong to leave him. However, she tells him that he must come to love his Father, for he is good and kind, and is far better than she will ever be. Karenin sees Anna and motions for her to leave. Anna returns to Vronsky's hotel room.Vronsky arrives late, and Anna starts to believe that he is fooling around. Anna whips up her courage to attend the Opera, proclaiming that she is not ashamed for what she has done, and neither should Vronsky. Anna attends the Opera and the attendees look at her with disgust and amusement. She starts to understand that society is still not accepting of her or Vronsky. One of the other attendees then starts a ruckus and verbally insults Anna. All of the Opera house sees the commotion, including Vronsky. Anna is humiliated, but retains her poise, but cries back at the hotel. Vronsky rushes to her, and she yells at him and asks him why he did not stop her from going. Vronsky tries to settle the situation by giving her laudanum with water. The next day Anna has lunch at a restaurant where the society women there ignore her and go out of their way to avoid her. Dolly grabs a seat next to her and tells Anna that Kitty is pregnant and is in Moscow to have the baby. Dolly explains that Stiva is the same, but that she has come to love him for who he is, and that she misses Anna. As Anna arrives at the Hotel, Vronsky is reading a letter, but then hides it. Anna informs Vronsky that she doesn't want to think about a divorce or anything only that she loves him and that wherever he goes she shall go with him. Vronsky informs her that he must meet with his mother one last time to settle some accounts, but when Anna sees that Princess Sorokina has come by the hotel to pick him up to send him to his mother's, Anna starts to lose her grip on reality. She drinks more laudanum, and asks her maid to dress her. Anna goes by train to see if Vronsky is truly with his mother.As she stops from station to station she thinks of her son, her daughter, Karenin, and has a hallucination of Vronsky and Princess Sorokina making love, and laughing about her. At the last station, Anna yells out, "God forgive me!" as she jumps on the tracks and into the path of an oncoming train.Levin, still shocked and amazed at Kitty's kind heart and willingness to have helped his brother, realizes that love while immature in the beginning can grow into something more beautiful and more earnest. He also starts to believe that fate is indeed the working of God, and how God truly has blessed him with Kitty and now with a son.He returns home in the rain to find Kitty giving their newborn son a bath. He tells her that he just realized something. Kitty asks him what is, and Levin cradling his baby boy in his arms looks at her, with tears in his eyes and says that someday he will tell her. Oblonsky and his family eat with Levin and Kitty, and Oblonsky looking weary and sad, goes outside lights a cigarette and seems to be crying. It can be implied that he is mourning his sister, or that he is indeed happy and will give up his old life as an adulterer. Karenin is seen to be happily retired from public duties. Serozha and Anya, now a toddler, are seen playing among the daisies growing in the field.
Output: Question: What is the name of the prostitute Nikolai takes as his wife?, Answer: Masha