Junk Journey
시간 제한1초메모리 제한1024 MB
무한 격자 위의 로봇을 조종해 스쿠터를 밀어서 100000번 이내의 이동으로 모든 스쿠터를 창고에 넣는 이동 순서를 출력한다.
문제
You are MALL-E, the mall scooter scooper robot. Your job is to fetch all the misplaced mall scooters at the end of the day and return them to the scooter depot. The mall is an infinite grid, containing scooters that need to be returned. You can move in one of four directions: up, down, left, or right, and each move takes one second. If you move to a location that contains a scooter, that scooter moves to the next location in the same direction you were moving. If a scooter moves into a location that contains another scooter, the same thing happens, so there is never more than one scooter at each location and you never occupy the same location as a scooter. If a scooter moves to the scooter depot, it disappears. However, the robot can freely move over the scooter depot.
The mall will soon open. You need to find a way to get all the scooters to the depot in at most seconds.

A picture of Sample Input 2. The two leftmost scooters can be pushed in the depot by moving up three times and moving right twice.
입력
The first line of the input contains a single integer (). The next line contains four integers , , , and (). This indicates that you start at and the depot is located at . Then follow lines, each containing two integers and (). This indicates that there is a scooter located at . You, the depot, and all the scooters will all have distinct locations.
출력
The output should contain a sequence of instructions, each on its own line. An instruction is one of the following strings: "up". "down", "left", or "right".