Math jam
Daria and Mary play a game with towers made of sandwiches of two types: apricot and raspberry. The game rules are as follows:
Players alternate turns with Daria going first; a player unable to make a valid move loses.
On their turn, a player removes one sandwich of their type (apricot is Daria's type and raspberry is Mary's) from any tower. They can take it from any position.
But if a player tries to remove a sandwich that supports the tower (its base, and it must be a sandwich of their type), they must eat the entire tower instead (even if there are sandwiches of another players in this tower).
You are given towers and queries of the form . The task is to determine who is going to win if the game was played on the towers whose indexes are from segment .
Input
The first line contains two integers and — the number of towers, and the number of queries.
The next lines describe the towers in format (, ). if the base of -th tower is apricot sandwich. if the base of -th tower is raspberry sandwich. indicates the total number of apricot sandwiches in -th tower. indicates the total number of raspberry sandwiches in -th tower. If then . If then .
The next lines contain a pair of integers — the parameters of the -th query.
Output
On the -th line output «Daria
» if Daria wins when the game is played on towers from -th query. Otherwise, output «Mary
».
Examples
Note
In the second query, we have such towers: (starting from the base). On the first move, Daria has two options:
If Daria takes the sandwich from the first tower making the towers , then Mary is forced to take her only sandwich to make towers . Then Daria takes the last sandwich and after Mary can't make a move, so Daria wins;
If Daria takes the sandwich from the second tower making the towers , then Mary is forced to take her only sandwich (she takes a sandwich from the base, therefore eats a whole tower). After that there are no towers left, Daria can't make a valid move, therefore Mary wins.
Daria can win if she does the first described move and therefore she wins in this case.
Scoring
( points): ;
( points): ;
( points): ;
( points): ;
( points): ;
( points): .
( points): ;
( points): ;
( points): no additional constraints;