Saturn planet

0

0 votes
Problem

Saturn is the second-largest planet in our solar system. It is adorned with a dazzling system of icy rings which makes it unique among the planets.

You have been given center of the Saturn planet i.e. (0, 0) and assume that a point on its outer surface of the sphere is (XP, YP)  and two points which lie on the inner circumference and outer circumference of the ring are (XR1, YR1) and (XR2, YR2)(it is not necessary that (XR1, YR1) lies on inner circumference ). You are given a point (PX, PY). You need to find whether the point (PX, PY) lies in/on the sphere or in/on the ring.

INPUT

  • First line contains (XP, YP) - a point on its outer surface.
  • Second line contains (XR1, YR1) and (XR2, YR2) - two points on the inner and outer circumference of the ring.
  • Next line contains the point (PX, PY).

NOTE: You need to take input explicitly as it is in the sample test case i.e. with bracket and comma. And Ring lies outside the Sphere, which is followed in the test cases.

OUTPUT

Print "SPHERE"(without quotes) if (PX, PY) lies in/on the sphere. Print "RING"(without quotes) if (PX, PY) lies in/on the ring. else Print "NONE"(without quotes).

CONSTRAINT

1 <= XP, YP ,  XR1, YR1 , XR2, YR2 , PX, P<= 100

Time Limit: 0.2
Memory Limit: 256
Source Limit:
Explanation

(0,4) lies in between (0,3) and (0,5). So the point (0,4) lies in the ring.

Editor Image

?