Winter has arrived at the farm, and with it snow. The path from the farmhouse to the barn is made of N tiles, numbered 1 through N starting at the house, and tile i is covered in fi feet of snow.
The farmer keeps B pairs of boots in the cellar, numbered 1 through B. Some pairs are sturdier than others and some are lighter than others. Pair i lets the farmer step in snow at most si feet deep, and lets him move at most di tiles forward in one step.
The farmer starts on tile 1 and has to reach tile N to wake the cows. The farmhouse roof covers tile 1 and the barn roof covers tile N, so neither tile has snow on it.
One step moves the farmer forward by at least 1 and at most di tiles, and the tile he lands on must be covered by at most si feet of snow. The snow on the tiles he passes over does not matter. For each pair of boots, decide whether the farmer can get from tile 1 to tile N.