Read problems statements in Mandarin Chinese here 

------ Problem Statement ------ 

Lira is a little girl form Bytenicut, a small and cozy village located in the country of Byteland.
 As the village is located on a somewhat hidden and isolated area, little Lira is a bit lonely and she needs to invent new games that she can play for herself.
However, Lira is also very clever, so, she already invented a new game. 
She has many stones with her, which she will display on groups of three stones on the ground on a triangle like shape and then, she will select two triangles, one with the smallest area and one with the largest area as the most beautiful ones.
While it's easy for Lira to "estimate" the areas of the triangles by their relative sizes, it's harder for her to actually calculate these areas.
But, it turns out, that Lira is also friends with YOU, an exceptional Mathematics student, and she knew that you would know exactly how to do such verification.
Lira also numbered the triangles from 1 to N, and now she wants to know the indices of the triangles with the smallest and largest area respectively.
It is now up to you, to help Lira and calculate the areas of the triangles and output their numbers.

------ Input ------ 

The first line of the input file contains an integer, N, denoting the number of triangles on the given input file.
Then N lines follow, each line containing six space-separated integers, denoting the coordinates x_{1}, y_{1}, x_{2}, y_{2}, x_{3}, y_{3}

------ Output ------ 

You should output two space separated integers, the indexes of the triangles with the smallest and largest area, respectively.

If there are multiple triangles with the same area, then the last index should be printed.

------ Constraints ------ 

$2 ≤ N ≤ 100$
$-1000 ≤  x_{i}, y_{i} ≤ 1000$
 
----- Sample Input 1 ------ 
2
0 0 0 100 100 0
1 1 1 5 5 1
----- Sample Output 1 ------ 
2 1

Difficulty: EASY
Tags: Geometry

Mathematics

Starter code:

Solutions:
n = int(input())
triangles = []
areas = []
for i in range(n):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	triangles.append((x1, y1, x2, y2, x3, y3))
for i in range(n):
	(x1, y1, x2, y2, x3, y3) = triangles[i]
	area = abs(x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) * 0.5
	areas.append(area)
min_index = n - areas[::-1].index(min(areas))
max_index = n - areas[::-1].index(max(areas))
print(min_index, max_index)


N = int(input())
max1 = 0
index1 = 0
index2 = 0
min1 = 999999
for i in range(N):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	A1 = abs(0.5 * (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)))
	if A1 >= max1:
		max1 = A1
		index1 = i
	if A1 <= min1:
		min1 = A1
		index2 = i
print(index2 + 1, index1 + 1)


l = []
n = int(input())
for i in range(n):
	(x1, y1, x2, y2, x3, y3) = list(map(int, input().split()))
	area = abs(x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2))
	area = area / 2
	l += [area]
a = l[::-1].index(min(l))
b = l[::-1].index(max(l))
print(n - a, n - b)


n = int(input())
l = []
for h in range(n):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	s1 = x1 * (y2 - y3)
	s2 = x2 * (y3 - y1)
	s3 = x3 * (y1 - y2)
	a = abs(0.5 * (s1 + s2 + s3))
	l.append(a)
l = l[::-1]
print(len(l) - l.index(min(l)), len(l) - l.index(max(l)))


n = int(input())
li = []
for i in range(n):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	area = abs((x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) / 2)
	li.append(area)
max1 = max(li)
min1 = min(li)
li = li[::-1]
ind1 = li.index(max1)
ind2 = li.index(min1)
print(n - ind2, n - ind1)


l = []
for _ in range(int(input())):
	(a1, b1, a2, b2, a3, b3) = map(int, input().split())
	l.append(0.5 * abs(a1 * (b2 - b3) + a2 * (b3 - b1) + a3 * (b1 - b2)))
print(len(l) - l[::-1].index(min(l)), len(l) - l[::-1].index(max(l)))


T = int(input())
tr = []
for tc in range(T):
	(x1, y1, x2, y2, x3, y3) = list(map(int, input().split(' ')))
	area = abs(0.5 * (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)))
	tr.append(area)
tr = tr[::-1]
print(T - tr.index(min(tr)), T - tr.index(max(tr)))


D = []
N = int(input())
for _ in range(N):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	area = abs(x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2))
	D.append(area)
m = max(D)
n = min(D)
D = D[::-1]
print(N - D.index(n), N - D.index(m))


l = []
n = int(input())
for _ in range(n):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	l.append(abs((x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) * 0.5))
l = l[::-1]
print(n - l.index(min(l)), end=' ')
print(n - l.index(max(l)))


n = int(input())
x = 0
y = 99999999
ans = an = 0
for i in range(n):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	area = abs(x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2))
	if area >= x:
		x = area
		ans = i + 1
	if area <= y:
		y = area
		an = i + 1
print(an, ans)


n = int(input())
area = []
(mn, mx) = (0, 0)
(indmn, indmx) = (1, 1)
for N in range(n):
	(x1, y1, x2, y2, x3, y3) = [int(x) for x in input().split()]
	val = x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)
	val /= 2
	val = abs(val)
	area.append(val)
	if N == 0:
		(mn, mx) = (val, val)
	else:
		if val <= mn:
			mn = val
			indmn = N + 1
		if val >= mx:
			mx = val
			indmx = N + 1
print(indmn, indmx)


import numpy as np
n = int(input())
l = []
for i in range(n):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	det = 0.5 * abs(x1 * (y2 - y3) - y1 * (x2 - x3) + x2 * y3 - y2 * x3)
	l.append(det)
(ma, mi) = (l[0], l[0])
(i_ma, i_mi) = (0, 0)
for i in range(len(l)):
	if l[i] >= ma:
		i_ma = i + 1
		ma = l[i]
	if l[i] <= mi:
		i_mi = i + 1
		mi = l[i]
print(i_mi, i_ma)


N = int(input())
A = []
for i in range(N):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	area = x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)
	A.append(abs(area))
A = A[::-1]
print(N - A.index(min(A)), N - A.index(max(A)))


try:
	n = int(input())
	result = []
	for i in range(n):
		co = list(map(int, input().split()))
		(x1, y1, x2, y2, x3, y3) = (co[0], co[1], co[2], co[3], co[4], co[5])
		a = abs(x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) / 2
		result.append(a)
	result.reverse()
	p = result.index(min(result))
	q = result.index(max(result))
	print(n - p, n - q)
except:
	pass


l = []
for t in range(int(input())):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split(' '))
	d = int(x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2))
	a = max(d, -d) / 2
	l.append(a)
l.reverse()
r = t - l.index(max(l)) + 1
s = t - l.index(min(l)) + 1
print(s, r)


n = int(input())
l = []
for i in range(n):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	s = abs(0.5 * (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)))
	l.append(s)
l = l[::-1]
print(len(l) - l.index(min(l)), len(l) - l.index(max(l)))


ma = 0
mi = 1000000000000000000
maxi = 0
mini = 0
for _ in range(int(input())):
	(a1, a2, b1, b2, c1, c2) = map(int, input().split())
	area = abs(a1 * (b2 - c2) + b1 * (c2 - a2) + c1 * (a2 - b2)) / 2
	if area >= ma:
		maxi = _ + 1
		ma = area
	if area <= mi:
		mini = _ + 1
		mi = area
print(mini, maxi)


triangles = int(input())
area_arr = []
for i in range(triangles):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	area = abs((x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) / 2)
	area_arr.append(area)
area_arr = area_arr[::-1]
min_index = area_arr.index(min(area_arr))
max_index = area_arr.index(max(area_arr))
print(triangles - min_index, triangles - max_index)


(m, mm) = (0, 1000000000000000)
(x, y) = (0, 0)
n = int(input())
for i in range(n):
	l = list(map(int, input().split()))
	s = abs(l[0] * (l[3] - l[5]) + l[2] * (l[5] - l[1]) + l[4] * (l[1] - l[3])) / 2
	if s >= m:
		m = s
		x = i + 1
	if s <= mm:
		mm = s
		y = i + 1
print(y, x)


def area(x1, y1, x2, y2, x3, y3):
	return abs((x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) // 2)
max_i = 0
min_i = 0
mx = 0
mn = float('inf')
for i in range(int(input())):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	arae = area(x1, y1, x2, y2, x3, y3)
	if arae >= mx:
		max_i = i + 1
		mx = arae
	if arae <= mn:
		min_i = i + 1
		mn = arae
print(min_i, max_i)


n = int(input())
areas = []
for _ in range(n):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	area = abs(0.5 * (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)))
	areas.append(area)
(low, high) = (0, 0)
for i in range(1, len(areas)):
	if areas[low] >= areas[i]:
		low = i
	if areas[high] <= areas[i]:
		high = i
print(low + 1, high + 1)


try:
	n = int(input())
	y = []
	for i in range(n):
		a = list(map(int, input().split()))
		z = abs(a[0] * (a[3] - a[5]) + a[2] * (a[5] - a[1]) + a[4] * (a[1] - a[3])) / 2
		y.append(z)
	y.reverse()
	s = y.index(max(y))
	t = y.index(min(y))
	print(n - t, n - s)
except:
	pass


try:

	def area():
		n = int(input())
		b = []
		for i in range(n):
			(x1, y1, x2, y2, x3, y3) = map(int, input().split())
			m = abs(0.5 * ((x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1)))
			b.append(m)
		p = [i for (i, j) in enumerate(b) if j == max(b)]
		q = [i for (i, j) in enumerate(b) if j == min(b)]
		print(q[-1] + 1, p[-1] + 1)
	area()
except:
	pass


import math
(ma, mi) = (0, math.inf)
(a1, b) = (0, 0)
for i in range(int(input())):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	a = abs((x1 * y2 + x2 * y3 + x3 * y1 - y1 * x2 - y2 * x3 - y3 * x1) / 2)
	if a >= ma:
		ma = a
		a1 = i + 1
	if a <= mi:
		mi = a
		b = i + 1
print(b, a1)


from math import sqrt
inf = 10 ** 9

def dist(m, n):
	return sqrt(abs(m[0] - n[0]) ** 2 + abs(m[1] - n[1]) ** 2)

class Triangle:

	def __init__(self, a, b, c):
		self.a = a
		self.b = b
		self.c = c

	def area(self):
		side_a = dist(self.a, self.b)
		side_b = dist(self.b, self.c)
		side_c = dist(self.a, self.c)
		s = (side_a + side_b + side_c) / 2
		return sqrt(s * (s - side_a) * (s - side_b) * (s - side_c))

def solve(*args):
	(n, triangles) = args
	(smallest, largest) = (inf, -inf)
	ans = [0, 0]
	for t in triangles:
		t_area = t[0].area()
		if t_area <= smallest:
			smallest = t_area
			ans[0] = t[1] + 1
		if t_area >= largest:
			largest = t_area
			ans[1] = t[1] + 1
	return ans

def do_codechef():
	n = int(input())
	t = list()
	for _ in range(n):
		a = list(map(int, input().split(' ')))
		t.append(Triangle(*[x for x in zip(a[::2], a[1::2])]))
	print(*solve(n, [(m, l) for (l, m) in enumerate(t)]))
do_codechef()
exit()


max = 0
min = 999999999
realmax = 1
realmin = 1
n = int(input())
for i in range(n):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	area = abs(1 / 2 * (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)))
	if max <= area:
		max = area
		realmax = i + 1
	if min >= area:
		min = area
		realmin = i + 1
print(realmin, realmax, end=' ')


mi = 10000000
ma = 0
mni = 0
mai = 0
for i in range(int(input())):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	a = ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
	b = ((x3 - x2) ** 2 + (y3 - y2) ** 2) ** 0.5
	c = ((x1 - x3) ** 2 + (y1 - y3) ** 2) ** 0.5
	s = (a + b + c) / 2
	s = (s * (s - a) * (s - b) * (s - c)) ** 0.5
	if s <= mi:
		mi = s
		mni = i + 1
	if s >= ma:
		ma = s
		mai = i + 1
print(mni, mai, end=' ')


def area(x1, y1, x2, y2, x3, y3):
	d = x1 * (y2 - y3) - y1 * (x2 - x3) + (x2 * y3 - x3 * y2)
	return abs(d)
n = int(input())
ar = []
for i in range(n):
	[x1, y1, x2, y2, x3, y3] = [int(j) for j in str(input()).split(' ')]
	d = area(x1, y1, x2, y2, x3, y3)
	ar.append(d)
mi = min(ar)
ma = max(ar)
i = 0
x = -1
y = -1
while i < len(ar):
	if ar[i] == mi:
		if x < i:
			x = i
	if ar[i] == ma:
		if y < i:
			y = i
	i = i + 1
ss = str(x + 1) + ' ' + str(y + 1)
print(ss)


def triangeArea(x1, y1, x2, y2, x3, y3):
	return abs(0.5 * (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)))
max_area = 0
max_index = 0
min_area = 999999999
min_index = 0
for i in range(int(input())):
	(a, b, c, d, e, f) = map(int, input().split())
	area = triangeArea(a, b, c, d, e, f)
	if area >= max_area:
		max_area = area
		max_index = i + 1
	if area <= min_area:
		min_area = area
		min_index = i + 1
print(min_index, max_index)


N = int(input())
mx = 0
mn = float('inf')
mxi = -1
mni = -1
for n in range(N):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	a = abs(x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) // 2
	if a >= mx:
		mx = a
		mxi = n + 1
	if a <= mn:
		mn = a
		mni = n + 1
print(mni, mxi)


t = int(input())
mn = 99999999
mx = -999999
mn_i = 0
mx_i = 0
for i in range(t):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	ans = abs(x1 * y2 + x2 * y3 + x3 * y1 - (x1 * y3 + x2 * y1 + x3 * y2))
	if mx <= ans:
		mx = ans
		mx_i = i + 1
	if mn >= ans:
		mn = ans
		mn_i = i + 1
print(mn_i, ' ', mx_i)


n = int(input())
(areamin, areamax) = (1e+20, 0)
(indexmin, indexmax) = (1e+20, 0)
for i in range(n):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	area_est = 0.5 * abs(x1 * (y2 - y3) - y1 * (x2 - x3) + x2 * y3 - y2 * x3)
	if area_est >= areamax:
		areamax = area_est
		indexmax = i + 1
	if area_est <= areamin:
		areamin = area_est
		indexmin = i + 1
print(indexmin, indexmax)


n = int(input())
(x1, y1, x2, y2, x3, y3) = map(int, input().split())
area = abs(x1 * y2 + x2 * y3 + x3 * y1 - x2 * y1 - x3 * y2 - x1 * y3)
areamax = area
areamin = area
minimum = 1
maximum = 1
for i in range(n - 1):
	(x4, y4, x5, y5, x6, y6) = map(int, input().split())
	area2 = abs(x4 * y5 + x5 * y6 + x6 * y4 - x5 * y4 - x6 * y5 - x4 * y6)
	if area2 >= areamax:
		maximum = i + 2
		areamax = area2
	if area2 <= areamin:
		minimum = i + 2
		areamin = area2
print(minimum, maximum)


n = int(input())
min_a = 1000000000.0
min_i = 1
max_a = -1.0
max_i = 1
for i in range(n):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	area = abs(x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) / 2.0
	if area <= min_a:
		min_a = area
		min_i = i + 1
	if area >= max_a:
		max_a = area
		max_i = i + 1
print(min_i, max_i)


N = int(input())
t = []
(min1, max1) = (0, 0)
(min2, max2) = (1, 1)
for i in range(N):
	(x1, y1, x2, y2, x3, y3) = list(map(int, input().split()))
	s = (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) / 2
	s = abs(s)
	t.append(s)
	if i == 0:
		(min1, max1) = (s, s)
	else:
		if s <= min1:
			min1 = s
			min2 = i + 1
		if s >= max1:
			max1 = s
			max2 = i + 1
print(min2, max2)


n = int(input())
mx = -float('inf')
mn = float('inf')
mnind = 0
mxind = 0
for i in range(n):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	area = 0.5 * (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2))
	area = abs(area)
	if area <= mn:
		mn = area
		mnind = i + 1
	if area >= mx:
		mx = area
		mxind = i + 1
print(mnind, mxind)


def calculate_area(coordinates):
	area = []
	for (x1, y1, x2, y2, x3, y3) in coordinates:
		a = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** (1 / 2)
		b = ((x3 - x2) ** 2 + (y3 - y2) ** 2) ** (1 / 2)
		c = ((x3 - x1) ** 2 + (y3 - y1) ** 2) ** (1 / 2)
		s = (a + b + c) / 2
		ar = (s * (s - a) * (s - b) * (s - c)) ** (1 / 2)
		area.append(ar)
	for (i, item) in enumerate(area):
		if item == min(area):
			minindex = i + 1
		if item == max(area):
			maxindex = i + 1
	return f'{minindex} {maxindex}'
l = []
for _ in range(int(input())):
	l.append(list(map(int, input().split())))
print(calculate_area(l))


vishnesh = int(input())
ar = []
for vish in range(vishnesh):
	(x1, y1, x2, y2, x3, y3) = list(map(int, input().strip().split()))
	l1 = ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
	l2 = ((x1 - x3) ** 2 + (y1 - y3) ** 2) ** 0.5
	l3 = ((x3 - x2) ** 2 + (y3 - y2) ** 2) ** 0.5
	s = (l1 + l2 + l3) / 2
	ar.append((s * (s - l1) * (s - l2) * (s - l3)) ** 0.5)
mn = min(ar)
mx = max(ar)
for i in range(vishnesh - 1, -1, -1):
	if mn == ar[i]:
		l = i
		break
for i in range(vishnesh - 1, -1, -1):
	if mx == ar[i]:
		m = i
		break
print(l + 1, m + 1)


l = []
for _ in range(int(input())):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	area = abs(x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) * 0.5
	l.append(area)
mi = min(l)
ma = max(l)
mid = -1
mad = -1
for i in range(len(l)):
	if mi == l[i]:
		mid = i + 1
	if ma == l[i]:
		mad = i + 1
print(mid, mad)


n = int(input())
ans = []
for i in range(n):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	line_1 = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
	line_2 = ((x3 - x2) ** 2 + (y3 - y2) ** 2) ** 0.5
	line_3 = ((x3 - x1) ** 2 + (y3 - y1) ** 2) ** 0.5
	s = (line_1 + line_2 + line_3) / 2
	area = (s * (s - line_1) * (s - line_2) * (s - line_3)) ** 0.5
	ans.append(area)
(ma, mi) = (ans[0], ans[0])
val_min = val_max = 0
for i in range(len(ans)):
	if ans[i] >= ma:
		ma = ans[i]
		val_max = i + 1
	if ans[i] <= mi:
		mi = ans[i]
		val_min = i + 1
print(val_min, val_max)


import math
mx = 0
mn = 10000000
mni = 0
mxi = 0
n = int(input())
for i in range(n):
	(x1, y1, x2, y2, x3, y3) = (int(o) for o in input().split())
	d1 = math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
	d2 = math.sqrt((x2 - x3) ** 2 + (y2 - y3) ** 2)
	d3 = math.sqrt((x3 - x1) ** 2 + (y3 - y1) ** 2)
	s = (d1 + d2 + d3) / 2
	a = math.sqrt(s * (s - d1) * (s - d2) * (s - d3))
	if a >= mx:
		mx = a
		mxi = i
	if a <= mn:
		mn = a
		mni = i
mxi += 1
mni += 1
print(mni, mxi, sep=' ')


l = []
N = int(input())
for i in range(N):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	Area = 0.5 * abs(x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2))
	l.append(Area)
(a, b) = (l[0], l[0])
(c, d) = (0, 0)
for i in range(len(l)):
	if l[i] <= a:
		a = l[i]
		c = i + 1
	if l[i] >= b:
		b = l[i]
		d = i + 1
print(c, d)


import sys
n = int(input())
arr = []
for n in range(n):
	arr.append([int(i) for i in input().split()])
max = -sys.maxsize - 1
min = sys.maxsize
ans1 = 0
ans2 = 0
for i in range(len(arr)):
	area = abs(arr[i][0] * (arr[i][3] - arr[i][5]) + arr[i][2] * (arr[i][5] - arr[i][1]) + arr[i][4] * (arr[i][1] - arr[i][3])) * 0.5
	if area >= max:
		max = area
		ans1 = i
	if area <= min:
		min = area
		ans2 = i
print(str(ans2 + 1) + ' ' + str(ans1 + 1))


def area(x):
	a1 = x[0] * (x[3] - x[5])
	a2 = x[2] * (x[5] - x[1])
	a3 = x[4] * (x[1] - x[3])
	return abs(a1 + a2 + a3)
ma = 0
mi = 10 ** 9
t = 0
z = 0
for u in range(int(input())):
	x = [int(w) for w in input().split()]
	a = area(x)
	if a >= ma:
		t = u
		ma = a
	if a <= mi:
		z = u
		mi = a
print(z + 1, t + 1)


def area(l):
	ar = l[0] * (l[3] - l[5]) + l[2] * (l[5] - l[1]) + l[4] * (l[1] - l[3])
	ar = ar / 2
	return abs(ar)
array = []
for _ in range(int(input())):
	s = input().split(' ')
	l = [int(i) for i in s]
	tmp = area(l)
	array.append(tmp)
min_index = 0
max_index = 0
for i in range(len(array)):
	if array[max_index] <= array[i]:
		max_index = i
	if array[min_index] >= array[i]:
		min_index = i
i1 = min_index + 1
i2 = max_index + 1
print(*[i1, i2])


import math
ans_min = math.inf
in_min = -1
ans_max = -1
in_max = -1
for i in range(int(input())):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	d_1 = math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
	d_2 = math.sqrt((x1 - x3) ** 2 + (y1 - y3) ** 2)
	d_3 = math.sqrt((x2 - x3) ** 2 + (y2 - y3) ** 2)
	s = (d_1 + d_2 + d_3) / 2
	dis = math.sqrt(s * (s - d_1) * (s - d_2) * (s - d_3))
	if dis <= ans_min:
		ans_min = dis
		in_min = i
	if dis >= ans_max:
		ans_max = dis
		in_max = i
in_min += 1
in_max += 1
print(in_min, in_max, sep=' ')


n = int(input())
l = []
for i in range(n):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	a = abs(x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) * 0.5
	l.append(a)
maxi = l[0]
mini = l[0]
(mx, mn) = (0, 0)
for i in range(n):
	if maxi <= l[i]:
		maxi = l[i]
		mx = i + 1
	if mini >= l[i]:
		mini = l[i]
		mn = i + 1
print(mn, mx)


n = int(input())
z = []
for i in range(n):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	a = abs((x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) / 2)
	z.append(a)
(x, y) = ([], [])
e = max(z)
f = min(z)
for i in range(len(z)):
	if z[i] == e:
		x.append(i + 1)
	if z[i] == f:
		y.append(i + 1)
print(y[-1], x[-1])