Friendly Fire

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

You have been captured by an evil organization which seeks to exploit your algorithm skills to improve their weapons. The first task they forced you to work on was to program guided torpedoes. Naturally, your goal is to instead make the torpedoes miss every ship whenever possible.

A typical scenario where the torpedoes will be used is a 2D plane, where the torpedo is fired from (0,0)(0,0) towards mm ships in the positive yy-direction. Every ship has the form of a line segment parallel to the xx-axis, with integer coordinate endpoints. The torpedo is shaped like a single point, and every second it will travel from (x,y)(x,y) to either (x1,y+1)(x-1,y+1), (x,y+1)(x,y+1), or (x+1,y+1)(x+1,y+1). In other words, it will always go one unit forward, but your program decides how much sideways it should go. If the torpedo hits one of the ships (including one of the endpoints of a ship) it will explode, destroying the ship. On the other hand, if the torpedo stays in one piece for nn seconds, its fuel will run out and it will harmlessly sink to the ocean floor.

Write a program which, given the position of the mm ships, finds out whether it is possible to avoid them all, and if so, outputs instructions to do it.

입력

The first line of input contains two integers nn and mm (2n500,0002 \leq n \leq 500\\,000 and 0m200,0000 \leq m \leq 200\\,000), the number of seconds until the torpedo runs out of fuel, and the number of ships.

Then follow mm lines, each containing three integers x_1,x_2,yx\_1, x\_2, y (nx_1x_2n-n \leq x\_1 \leq x\_2 \leq n and 1y<n1 \leq y < n), indicating a ship with endpoints (x_1,y)(x\_1, y) and (x_2,y)(x\_2, y).

You may assume that no pair of ships touch each other.

출력

If it is possible to dodge all the ships, output a string of length nn containing the characters -, 00, and ++. This string represents how the torpedo should turn in each of the nn time steps. For example, if the first character is ++, then the torpedo will start by going from (0,0)(0,0) to (1,1)(1,1). If there are multiple solutions, output any one of them. If it is impossible to avoid all the ships, output "impossible".