DRNTEAGL - Duronto Eagle

During his study in Amazing International University-Bangladesh Kazi Hossain accidentally made a space ship while doing a course assignment. He named the space ship Duronto Eagle. Now he wants to travel to other habitable planets in the galaxy with Duronto Eagle. As Kazi is a very brave guy he wants to start his space journey by travelling to the farthest planet in the galaxy first.

The co-ordinate of the planet Kazi is currently in (planet Earth) is always (0, 0). You are given the co-ordinates of the other N habitable planets in the galaxy in a 2D Cartesian plane. You have to find the index of the farthest planet considering the Euclidean distance from planet Earth (0, 0). Indices range from 1 to N.

Input

Input starts with an integer T (≤ 100), denoting the number of test cases. Each of the test cases starts with an integer N (1 ≤ N ≤ 50), denoting the number of planets. Each of the next N lines contains two integers xi yi (-10000 ≤ xi, yi ≤ 10000) describing the coordinates of the planets in the galaxy.

Output

For each case print the case number and the index of the farthest planet from Earth that Kazi will be travelling first. If there’s multiple possible answers output the one that comes first in the input. See sample input output for clarification.

Example

Input:
2
3
4 0
0 5
2 2
4
2 3
1 1
5 5
-4 -1

Output:
Case 1: 2
Case 2: 3

Added by:imranziad
Date:2015-10-07
Time limit:0.5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 GOSU JS-MONKEY
Resource:AIUB Beginners Team Formation Contest (Round 5) Onsite

hide comments
2016-08-28 15:43:50
Why is this under geometry ?? Its simple math implementation
2016-04-09 12:50:48
My code accepted in idone.com but spoj is wrong answer @@ ??
2016-03-06 12:54:53
can you please detect what is the problem in my code???i am just out of mind.
2016-02-18 07:15:57 rahul_verma
what is problem in my code ?????
2016-01-06 18:40:34
Do I have to print "Case"?
2015-10-17 06:54:43 Vars
is there a sapce after colon in O/p??
2015-10-12 15:31:24
Move to it basic..!!!!
2015-10-12 00:15:17
Input format is not good. Languages like ruby, python, c# might get runtime errors. Use space as a delimeter for reading input and do not read entire line.
2015-10-09 22:13:51
Runtime error on C#. Simple approach. Is the input data not according to description?
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.