SMPCIRC - Two Circles

Given two circles: O1 with the center o1 = (x1, y1) and a radius r1 and O2 with the center o2 = (x2, y2) and radius r2, please compute if O1 is inside O2 or if O2 is inside O1.

Input

First t < 1000, the number of test cases. In each of the following t lines, 6 integers: x1 y1 r1 x2 y2 r2. Where 0 ≤ x1, y1, x2, y2 ≤ 10000 and 0 < r1, r2 ≤ 10000.

Output

For each test case print one character:

  • I, if O1 is inside O2 (or if O2 is inside O1),
  • E, if O1 is internally tangent to O2 (or if O2 is internally tangent to O1),
  • O, in other cases.

Example

Input:
2
103 104 5 100 100 10
103 104 10 100 100 10

Output:
E
O

Added by:kuszi
Date:2013-08-26
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64

hide comments
2017-11-20 07:42:33
if we get wrong answer in judge status how can we see where is the wrong
2017-03-18 04:19:00
where can we find the editorials of all the questions on this site??
2016-12-03 08:47:49
the basic idea is to compute the distance between O1 and O2, then compare it to r1 and r2
2016-10-13 06:50:33
basic idea, anyone?
2016-07-04 10:29:13
Easy
AC in 1 go! using Java :D
2016-05-18 06:25:53
my solution is giving correct answer in dev c++ but here it is saying wrong answer can anybody help me
2016-05-08 23:42:43
Despite giving correct results on ideone and my compiler, SPOJ shows the solution as incorrect?

2016-03-15 06:13:22 jang daemyung
Finally I solved it. I miss the type-casting when it changes from double to integer. It can be truncated.
2016-03-15 04:59:23 jang daemyung
Is there any person who let me know the corner cases?

or... what is the internally tagent to?

Last edit: 2016-03-15 05:22:30
2016-01-24 14:53:47 Naman Gupta
does spoj reads <math.h> library in C language?
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.