Billiards

No attempts yetTime limit1sMemory limit128 MB

Problem

On a Friday evening, Bajtazar and his friends head to a club for a game of billiards. As usual at such gatherings, an argument breaks out between Bajtazar and Bitol. Bajtazar claims that Bitol's strategy is pointless, because the ball he strikes has no chance of dropping into a pocket. Bitol insists that if he hit the ball hard enough, it would eventually fall into some pocket. Help settle their argument: write a program that decides whether the ball really would fall into a pocket, and if so, which one.

Your program should:

  • read the dimensions of the billiard table, the starting position of the struck ball, and the vector describing how the ball moves after the strike,
  • determine which pocket the ball falls into, or determine that it never falls into any pocket,
  • print the result.

Input

The one and only line contains six integers sxs_x, sys_y, pxp_x, pyp_y, wxw_x, wyw_y separated by single spaces:

  • sxs_x, sys_y: the dimensions of the table, with 1sx,sy1061 \le s_x, s_y \le 10^6 and sxs_x even,
  • pxp_x, pyp_y: the ball's starting position, with 0pxsx0 \le p_x \le s_x and 0pysy0 \le p_y \le s_y,
  • wxw_x, wyw_y: the motion vector, with 1000wx,wy1000-1000 \le w_x, w_y \le 1000.

The table is sxs_x long and sys_y wide. Pockets sit at the four corners and at the midpoints of the two sides of length sxs_x. For example, a table of size (8,3)(8, 3) has pockets at (0,0)(0, 0), (4,0)(4, 0), (8,0)(8, 0), (0,3)(0, 3), (4,3)(4, 3), and (8,3)(8, 3). The ball never leaves the table and moves without friction; every bounce off a cushion follows the rule that the angle of incidence equals the angle of reflection. The ball drops into a pocket exactly when it reaches the point where that pocket is located.

Output

Print a single line: the name of the pocket the ball drops into, or the word NIE if that never happens. The pocket names are:

  • GL: the pocket at (0,sy)(0, s_y)
  • GP: the pocket at (sx,sy)(s_x, s_y)
  • GS: the pocket at (sx/2,sy)(s_x/2, s_y)
  • DL: the pocket at (0,0)(0, 0)
  • DP: the pocket at (sx,0)(s_x, 0)
  • DS: the pocket at (sx/2,0)(s_x/2, 0)

Hint