CF331D3 Escaping on Beaveractor

Description

Don't put up with what you're sick of! The Smart Beaver decided to escape from the campus of Beaver Science Academy (BSA). BSA is a $ b×b $ square on a plane. Each point $ x,y $ $ (0

Input Format

The first line contains two integers: the number of traffic rules $ n $ and the size of the campus $ b $ , $ 0

Output Format

Print $ q $ lines. Each line should contain two integers — the Beaveractor's coordinates at the final moment of time for each plan. If the Smart Beaver manages to leave the campus in time $ t_{i} $ , print the coordinates of the last point in the campus he visited.