peterverebics/CodeNet_Python_118 huggingface dataset:
N = int(input())

d1=[]
d2=[]

cont=0
for i in range(N):
    D1,D2=map(int,input().split())

    d1.append(D1)
    d2.append(D2)

for i in range(len(d1)):
    if d1[i]==d2[i]:
        cont+=1

if cont>=3:
    print("Yes")
else:
    print("No")
loop = int(input())
streak = 0
for i in range(loop):
    diceArr = input().split()
    if streak==3:
        print('Yes')
        SystemExit
    else:
        if diceArr[0] == diceArr[1]:
            streak+=1
        else:
            streak=0
if streak != 3:
    print('No')
N=int(input())
D={}
for i in range(N):
    D[i]=input().split()

cou=0
for i in range(N):
    if D[i][0]==D[i][1]:
        cou+=1

if cou >= 3:
    print('Yes')
else:
    print('No')
n = int(input())
zoro = 0

for i in range(n):
  d1, d2 = map(int, input().split())
  if d1 == d2:
    zoro += 1
  else:
    zoro = 0

if zoro >= 3:
  print('Yes')
else:
  print('No')
n = int(input())
a = [[int(i) for i in input().split()] for j in range(n)]
good = False
for i in range(n-3):
  ok = True
  for j in range(i, i+3):
    ok &= a[i][0] == a[i][1]
  good |= ok
print("Yes" if good else "No")
N = int(input())

xy = [map(int,input().split()) for _ in range(N)]
x,y = [list(i) for i in zip(*xy)]

ans = 0

for i in range(N):
    if x[i] == y[i]:
        ans +=1
    else:
        ans = 0
        
if ans >= 3:
    print("Yes")
    
else:
    print("No")
import io,sys
def main(): 
    n = int(input())
    D = []
    for _ in range(n):
        a,b = map(int,input().split())
        D.append(a-b)
    
    for i in range(n-3):
        if D[i]==0 and D[i+1]==0 and D[i+2]==0:
            print("Yes")
            sys.exit()
    
    print("No")
main()
N = int(input())
count = 0
count_max = count
for i in range(N):
    di_1, di_2 = [int(i) for i in input().split()]
    if di_1 == di_2:
        count += 1
    else:
        count_max = max([count_max, count])
        count = 0
if count_max >= 3:
    print("Yes")
else:
    print("No")
n = int(input())
d = [list(map(int, input().split())) for _ in range(n)]

for i in range(n - 3):
  if all([d[i + j][0] == d[i + j][1] for j in range(3)]):
    print('Yes')
    exit()

print('No')
n = int(input())
ans = 0
f1, f2, f3 = 0, 0, 0
for i in range(n):
    f3 = f2
    f2 = f1
    d1, d2 = map(int, input().split())
    f1 = d1 == d2
    if f1 == f2 == f3:
        ans = 1
print('Yes' if ans else 'No')
n = int(input())

pv = []
con = 0

while n > 0:
    n -= 1
    s = str(input())
    d = s.split()
    if d[0] == d[1]:
        con += 1
    else:
        pv += [con]
        con = 0

pv += [con]
ans = max(pv)

if int(ans) >= 3:
    print('Yes')
else:
    print('NO')
n = int(input())
cnt = 0
for i in range(n):
    if cnt == 3:
        print('Yes')
        exit()
    x,y =map(int,input().split())
    if x == y:
        cnt +=1
    else:
        cnt = 0
print('No')
cnt = 0
n = int(input())
for i in range(0,n):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        cnt += 1
        if cnt == 3 :
            print("Yes")
            break
    else:
        cnt == 0
        
    if i == n-1:
        print("No")
N = int(input())
num = 0
for i in range(N):
  D = list(map(int, input().split(' ')))
  if D[0] == D[1]:
    num += 1
  else:
    num = 0

if num >= 3:
  print('Yes')
else:
  print('No')
def solution():
  N = int(input())
  xy = [map(int, input().split()) for _ in range(N)]
  x, y = [list(i) for i in zip(*xy)]

  cnt = 0
  for i in range(N):
    print (x[i], y[i])
    if cnt >= 3:
      return 'Yes'
    if x[i] == y[i]:
      cnt += 1
    else:
      cnt = 0
  return 'No'

print (solution())
N = int(input().strip())



a = []
c = []
f = 0

for i in range(N):
    array = list(map(int, input().strip().split()))
    a.append(array)

    
for i in range(N):
	if(f == 0 or f == i-1):
		if(a[i][0] == a[i][1]):
			f=i
			c.append(1)
		else:
			f=0


if(len(c) >= 3):
  print("Yes")
else:
  print("No")
# -*- coding: utf-8 -*-
# 入力
N = int(input())

l = []
for i in range(N):
    d1, d2 = map(int, input().split())
    l.append([d1, d2])
print(l)

flag = 0
cont = 0
for i in l:
    if(i[0]==i[1]):
        flag = 1
        cont = cont + 1
        print(cont)
        if (cont>=3):
            break
    else:
        cont = 0
        flag =0



if (cont >=3):
    print("Yes")
else:
    print("No")
n = int(input()) 
if n>=3:
    count = 0    
    for i in range(n):
        d = list(map(int, input().split(" ")))
        if  d[0]== d[1]: count+=1
    if count >= 3: print("yes")
    else: print("no")
else: pass
n = int(input())
D = [] * n

for i in range(n):
    D.append(list(map(int, input().split())))

ans = 'No'

for i in range(0, n-3):
    if D[i][0] == D[i][1] and D[i+1][0] == D[i+1][1] and D[i+2][0] == D[i+2][1]:
        ans = 'Yes'
        break

print(ans)
def judge():
    count = 0
    for _ in range(n):
        d1, d2 = map(int, input().split(" "))
        if d1 == d2:
            count += 1
        else:
            count = 0
        
        if count == 3:
            return True

    return False

n = int(input())

if judge():
    print("yes")
else:
    print("no")
x=int(input())
l=[]
c=0
for i in range(x):
    a,b = map(int,input().split())
    l.append(a)
    l.append(b)
for i in range(0,x*2,2):
    if l[i]==l[i+1]:
        c+=1
        
        if c>=3:
            print("YES")
            break

    else:
        c=0
if c<3:
    print("NO")
N=int(input()) #縦2列
XY=[map(int, input().split()) for _ in range(N)]
X,Y=[list(i) for i in zip(*XY)]
ans="no"

for j in range(0,N-2):
    if X[j]==Y[j] and X[j+1]==Y[j+1] and X[j+2]==Y[j+2]:
        ans="Yes"
        break

print(ans)
N = int(input())
x=[0]*N
y=[0]*N
L=[0]*N

flag = "No"

for i in range(N):
	x[i],y[i] = map(int, input().split())

for i in range(N):
  if x[i]==y[i]:
  	L[i]=1

#print(L)

for i in range (N-2):
  #print(i)
  if L[i] == L[i+1] == L[i+2]:
    flag = "Yes"

print(flag)
N = int(input())
cnt = []
for i in range(N):
    a, b = map(int, input().split())
    if a == b:
        cnt.append(1)
    else:
        cnt.append(0)
from itertools import groupby
for key, group in groupby(cnt):
    if  len(list(group)) >= 3:
        print('Yes')
        exit()
print('No')
n = int(input())
count=0
flg=0

for num in range(n):
    d1,d2 = map(int,input().split())
    if d1 == d2:
        count += 1
        if count>= 3:
            flg = 1

    else:
        count=0
else:
    if count > 3 | flg >0:
        print("Yes")
    else:
        print("No")
n=int(input())
s=0
for i in range(n):
  lis=input().split()
  if lis[0]==lis[1]:
    s+=1
  else:
    s=0
if s>=3:
  print("Yes")
else:
  print("No")
n = int(input())
num_list = []
for i in range(n):
    a,b = map(int,input().split())
    num_list.append((a,b))
    
counter = 0 
d = 0
for x,y in num_list:
    if counter == 3:
        d += 1
        break
    elif x == y:
        counter += 1
    else:
        counter = 0

if d == 1:
    print("Yes")
else:
    print("No")
x=int(input())
count=0
for a in range(x):
  b=input().split(' ')
  if int(b[0])==int(b[1]):
    count+=1
  else:
    count=0
  if count==3:
    break
if count==3:
  print('yes')
else:
  print('no')
N = int(input())


max = 0
stock = 0
for i in range(N):
  a,b = map(int, input().split())
  if a == b:
    stock += 1
    max = stock
  else:
    max = stock
    stock = 0

print('Yes' if (max > 2) else "No")
N = int(input(""))
count = 0
for i in range(N):
    D = (input(""))
    l = D.split()
    l_i = [int(s) for s in l]
    if l_i[0] == l_i[1]:
        count += 1
    else:
        pass
if count >= 3:
    print("Yes")
else:
    print("No")
n=int(input())
ans=0
for _ in range(n):
  a,b=map(int,input().split())
  if a==b:
    ans+=1
    if ans==3:
      break
  else:
    n=0
if ans==3:
  print("Yes")
else:
  print("No")
N = int(input())
D = [input() for i in range(N)]
count = 0
OK = 0
for ite in D:
    
    
    a,b = map(int,ite.split())
    
    if a == b:
        count += 1
        if count >=3:
            OK = 1
            print('Yes')
        
        else:
            pass
    
    else:
        count = 0
if OK == 0:
    print('No')
N = int(input())

Ds = [list(map(int, input().split())) for i in range(N)]
count = 0

for D in Ds:
    if D[0] == D[1]:
        count += 1

if count >= 3:
    print("Yes")
else:
    print("No")
N = int(input())
num_list = []
for i in range(N):
    num_list.append(list(map(int,input().split())))

for j in range(N-2):
    if num_list[j][0] == num_list[j][1] and num_list[j+1][0] == num_list[j+1][1] and num_list[j+2][0] == num_list[j+2][1]:
        print ("Yes")
        break
    elif j != N-3 and num_list[j][0] != num_list[j][1] or num_list[j+1][0] != num_list[j+1][1] or num_list[j+2][0] != num_list[j+2][1]:
        continue
    else:
        print("No")
n = int(input())
d = []
for i in range(n):
    x = list(map(int, input().split()))
    d.append(x)

d2 = []
ans = "No"

for i in range(n):
    for j in range(2):
        d2.append(d[i][j])

print(d2)

for i in range(0, len(d2)-2):
    if d2[i] == d2[i+1] and d2[i] == d2[i+2]:
        ans = "Yes"
        break

print(ans)
n = int(input())
cnt = 0
flg = False
for i in range(n):
    d1, d2 = map(int, input().split())
    if cnt == 3:
        flg = True
    if cnt > 0:
        if d1 == d2:
            cnt += 1
        else:
            cnt = 0
    if cnt == 0:
        if d1 == d2:
            cnt += 1
        else:
            pass
        
if flg:
    print('Yes')
else:
    print('No')
n=int(input())
count=0
for i in range(n):
  me1,me2=list(map(int,input().split()))
  if me1==me2:
    count+=1
    if count==3:
      break
  else:
    count=0
if count>=n:
  print('Yes')
else:
  print('No')
N = int(input())
D = [input() for i in range(N)]    

for i in range(3,N):
    if (D[i][0] == D[i][-1]) \
        and (D[i-1][0] == D[i-1][-1]) \
        and (D[i-2][0] == D[i-2][-1]):
            print('Yes')
            break
    if i == N-1:
        print('No')
N = int(input())
count = 0
for i in range(N):
    di_1, di_2 = [int(i) for i in input().split()]
    if di_1 == di_2:
        count += 1
    else:
        count = 0
if count >= 3:
    print("Yes")
else:
    print("No")
N=int(input())
D=list()
for i in range(N):
    tmp=list(map(int,input().split()))
    D.append(tmp[0]==tmp[1])
for i in range(N-3):
    if D[i]==D[i+1]==D[i+2]==True:
        print("Yes")
        break
else:
    print("No")
N = int(input(""))
count = 0
for i in range(N):
    D = (input(""))
    l = D.split()
    a = int(l[0])
    b = int(l[1])
    if a == b:
        count += 1
if count > 2:
    print("Yes")
else:
    print("No")
N=int(input())
cnt=0

for i in range(N):
  if cnt==3:
    print('Yes')
    break
  D_1,D_2=map(int,input().split())
  if D_1==D_2:
    cnt+=1
  else:
    cnt=0
else:
  print('No')
n=int(input())
l=[]
for _ in range(n):
  s=input().split()
  l.append([int(s[0]),int(s[1])])
flag=0
for i in range(3,n):
  if l[i][0]==l[i][1] and l[i-1][0]==l[i-1][1] and l[i-2][0]==l[i-2][1]:
    flag=1
    break
if flag:
  print("Yes")
else:
  print("No")
n = int(input())
d = []

for i in range(n) :
    input_line = list(map(int, input().split(" ")))
    d.append(input_line)

count = 0
answer = "no"
for i in range(n) :
    if d[i][0] == d[i][1] :
        count += 1
        if count > 1 :
            answer = "yes"
    else :
        count = 0
    
if answer == "yes" :
    print("Yes")
else :
    print("No")
n=int(input())
xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]
ans=''
for i in range(n-2):
  if x[i]==y[i] and x[i+1]==y[i+1] and x[i+2]==y[i+2]:
    ans='Yes'
  else:
    ans='No'
print(ans)
import random

x = int(input())

result = []
for n in range(x):
    z=[random.randint(1, 6),random.randint(1, 6)]
    if z[0]==z[1]:
        r="1"
    else:
        r="0"    
    result.append(r)

if "111" in "".join(result):print('Yes')
else:print('No')
n = int(input())
numList = []
for x in range(n):
	num = [int(x) for x in input().split()]
	if num[0] == num[1]:
		numList.append('True')
	else:
		numList.append('False')
		
	
judge = 'No'
for x in range(len(numList)-3):
    if numList[x] == 'True':
      if numList[x+1] == 'True':
        if numList[x+2] == 'True':
          judge = 'Yes'
print(judge)
a,b,c,d=map(int,input().split())
print(max(a*c,b*c,a*d,b*d))
a,b,c,d = map(int, input().split())
print(max(a*c,a*d,b*c,b*d))
#!/usr/bin/python
# -*- coding: UTF-8 -*-

import sys


def get_ints():
    return map(int, sys.stdin.readline().strip().split())


def main():
    a, b, c, d = get_ints()

    print(max(a*c, a*d, b*c, b*d))


if __name__ == "__main__":
    main()
a, b, c, d = map(int, input().split())

ans = b*d
ans = max(ans, a*d)
ans = max(ans, b*c)
ans = max(ans, a*c)

print(ans)
a, b, c, d = map(int, input().split())

A = a*c
B = a*d
C = b*c
D = b*d


print(max([A, B, C, D]))
a, b, c, d = list(map(int,input().split()))
print(max(a * c, a * d, b * c, b * d))
a,b,c,d=map(int,input().split())
print(max(a*c,a*d,b*c,b*d))
a, b, c, d = map(int, input().split())

ans = max(a*c, a*d, b*c, b*d)
print(ans)
a, b, c, d = map(int, input().split())
rst = max(a*c, b*d, b*c, a*d)
print(rst)
a, b, c, d = map(int, input().split())

ans = [a*c, a*d, b*c, b*d]
print(max(ans))
a, b, c, d = (int(i) for i in input().split())
if a > 0:
    if d > 0:
        print(max(a*c, a*d, b*c, b*d))
    else:
        print(max(a*c, a*d, b*c, b*d))
else:
    if d > 0:
        print(max(a*c, a*d, b*c, b*d))
    else:
        print(max(a*c, a*d, b*c, b*d))
a,b,c,d = [int(x) for x in input().split()]


print(max(a*c,a*d,b*c,b*d))
A, B, C, D = map(int, input().split())
if A <= 0 <= B or C <= 0 <= D:
    x = 0
else:
    x = -float('inf')

print(max(A * C, B * D, A * D, B * C, x))
a, b, c, d = map(int, input().split())

if b < 0:
    if c <= 0:
        print(a * c)
    else:
        print(b * c)

elif a <= 0:
    if d < 0:
        print(a*c)
    elif a <= 0:
        print(max(a*c, b*d))
    else:
        print(b*d)

else:
    if d < 0:
        print(a * d)
    else:
        print(b * d)
a, b, c, d = map(int, input().split())
print(max(a*c, a*d, b*c, b*d))
a,b,c,d=map(int,input().split())
ans = -10000000000000000000
ans = max( ans, a*c)
ans = max( ans, a*d)
ans = max( ans, b*c)
ans = max( ans, b*d)
print(ans)
a,b,c,d = map(int,input().split())
A = set()
B = set()
A.add(a)
A.add(b)
B.add(c)
B.add(d)
for i in {-1,0,1}:
    A.add(i)
    B.add(i)

o = set()
for j in A:
    for k in B:
        if a <= j <= b and c <= k <= d:
            o.add(j*k)
print(max(o))
a,b,c,d=list(map(int,input().split()))

m = max(a*c, b*d)
m = max(m, a*d)
m = max(m, b*c)

print(m)
#!/usr/bin/env python3

from typing import *



# def solve(a: int, b: int, c: int, d: int) -> int:
def solve(a, b, c, d):
    ans=[a*c, a*d, b*c, b*d]
    return max(ans)

def main():
    a, b, c, d = map(int, input().split())
    a1 = solve(a, b, c, d)
    print(a1)

if __name__ == '__main__':
    main()
def main():
    a, b, c, d = list(map(int, input().split()))
    return max(a * c, b * d, a * d, b * c)


# print('Yes' if main() else 'No')
print(main())
a, b, c, d = map(int, input().split())

x = max(a * c, a * d)
y = max(b * c, b * d)
z = max(x, y)

print(z)
a,b,c,d=map(int,input().split())
print(max([a*c,a*d,b*c,b*d]))
# -*- coding: utf-8 -*-

a,b,c,d = map(int, input().split())

res1 = a * c
res2 = a * d
res3 = b * c
res4 = b * d
ans = max(res1, res2, res3, res4)
print(ans)
a, b, c, d = [int(_) for _ in input().split()]
print(max(a * c, a * d, b * c, b * d))
a, b, c, d = map(int, input().split())
print(max(a * c, a * d, b * c, b * d))
input_arr = input().split(" ")
a = int(input_arr[0])
b = int(input_arr[1])
c = int(input_arr[2])
d = int(input_arr[3])

AC = a * c
AD = a * d
BC = b * c
BD = b * d

l = [AC, AD, BC, BD]
print(max(l))
#!/usr/bin/env python3
def main():
    a, b, c, d = map(int, input().split())

    ans = -10 ** 20
    for x in [a, b]:
        for y in [c, d]:
            ans = max(ans, x * y)
    print(ans)


if __name__ == '__main__':
    main()
a,b,c,d = map(int,input().split())
print(max(a*c,a*d,b*c,b*d))
a, b, c, d = map(int, input(). split())
print(max(a * c, a * d, b * c, b * d))
a, b, c, d = map(int, input().split())
answer = max(a*c, a*d, b*c, b*d)
print(answer)
a,b,c,d = map(int, input().split())

print(max(
  a*c,
  a*d,
  b*c,
  b*d
))
a,b,c,d = map(int, input().split())

ans = max(a*c,a*d, b*c,b*d)
print(ans)
a,b,c,d = map(int, input().split())
l = [a*c, a*d, b*c, b*d]
print(max(l))
a, b, c, d = [int(i) for i in input().split()]
nums = [a, b, c, d]

if a < 0 and b < 0 and 0 < c and 0 < d:
  print(b * c)
  exit(0)
if c < 0 and d < 0 and 0 < a and 0 < b:
  print(d * a)
  exit(0)


minus_num = len([i for i in nums if i < 0])
if minus_num == 4:
  print(a * c)
  exit(0)
if minus_num == 1 or minus_num == 0:
  print(b * d)
  exit(0)

if a * c < b * d:
  print(b * d)
else:
  print(a * c)
n = list(map(int, input().split()))
n_max = n[0] * n[2]
for i in range(0, 2):
    for j in range(2, 4):
        if n_max < n[i] * n[j]:
            n_max = n[i] * n[j]
print(n_max)
a, b, c, d = map(int, input().split())
print(max([a*c, a*d, b*c, b*d]))
def li():
    return [int(x) for x in input().split()]


a, b, c, d = li()

ans = max(a * c, a * d, b * c, b * d)
print(ans)
a, b, c, d = map(int, input().split())

print(max(a*c, a*d, b*c, b*d))
a,b,c,d = tuple(map(int, input().split(" ")))

print(max(a*c, a*d, b*c, b*d))
a, b, c, d = map(int, input().split())

result = -10**18
for x in [a, b]:
    for y in [c, d]:
        result = max(x * y, result)
print(result)
import numpy as np

a, b, c, d = map(int, input().split())
x = np.array([a, b])
y = np.array([c, d])
z = np.outer(x, y)
print(z.max())
#B
a,b,c,d = map(int,input().split())
print(max(a*c,a*d,b*c,b*d))
a,b,c,d = list(map(int,input().split()))
max = a*c
if a*d>max:
    max = a*d
if b*c>max:
    max = b*c
if b*d>max:
    max = b*d

print(max)
a,b,c,d=[int(x) for x in input().split()]
ans=max(a*c,b*d)
if a<0 and b<0:
  cc=a
  a=b
  b=cc

if c<0 and d<0:
  cc=c
  c=d
  d=cc

print(max(a*c,b*d,ans))
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
    A, B, C, D = map(int, input().split())
    ans = -10**9**2

    for ab in (A, B):
        for cd in (C, D):
            if ab * cd > ans:
                ans = ab * cd

    print(ans)


if __name__ == "__main__":
    main()
a,b,c,d = (int(x) for x in input().split())

ac = a * c
ad = a * d
bc = b * c
bd = b * d

print(max([ac,ad,bc,bd]))
a, b, c, d = [int(s) for s in input().split(" ")]
ans1 = a * c
ans2 = b * d
ans3 = a * d
ans4 = b * c
print("%d" % max([ans1, ans2, ans3, ans4]))
a,b,c,d=map(int,input().split())
x=max(a*c,a*d,b*c,b*d)
if (b<0 and 0<c) or (d<0 and 0<a):
    print(x)
else:
    print(max(x,0))
a,b,c,d=map(int,input().split())
list1=[a*c,a*d,b*c,b*d]
if (b<0 and c>0) or (a>0 and d<0):
  ans=max(list1)
else:
  list1.append(0)
  ans=max(list1)
print(ans)
a, b, c, d = map(int, input().split())
lst = [a * c, a * d, b * c, b * d]
print(max(lst))
def main():
    a, b, c, d = map(int, input().split())
    if b * d > 0 or a * c > 0:
        x = max(b * d, a * c)
    else:
        x = max(a * d, b * c)
    print(x)
    return

if __name__ == '__main__':
    main()
a, b, c, d = map(int, input().split())

print(max(a*d, b*c, b*d, a*c))
s = input()
nums = s.split()
a = int(nums[0])
b = int(nums[1])
c = int(nums[2])
d = int(nums[3])
print(max(a*c,a*d,b*c,b*d))
def resolve():
    a, b, c, d = map(int, input().split())
    w = a*c
    x = a*d
    y = b*c
    z = b*d
    ans = max(w, x, y, z)
    print(ans)

resolve()
a, b, c, d = map(int, input().split())

ans = [a * c, a * d, b * c, b * d]
print(max(ans))
a,b,c,d = list(map(lambda x: int(x), input().split()))
ac, bc, bd, ad = a*c, b*c, b*d, a*d

e1 = ac if ac >= bc else bc
e2 = bd if bd >= ad else ad
ans = e1 if e1 >= e2 else e2
print(ans)
#Python Template

from sys import stdin, stdout

def main():
	a, b, c, d = [int(i) for i in stdin.readline().split()]
	ans = max(a*c, a*d, b*c, b*d)
	print(ans)

main()
import math

def a():
    x = int(input())
    if x == 0:
        print(1)
    else:
        print(0)


def b():
    a,b,c,d = map(int,input().split())
    m=[a*c,a*d,b*c,b*d]
    print(max(m))



def c():
    pass



def d():
    pass


# a()
b()
# c()
# d()
N = input()
num = N.split(' ')
a = int(num[0])
b = int(num[1])
c = int(num[2])
d = int(num[3])

e = a * c
f = a * d
g = b * c
h = b * d
num_max = max([e, f, g, h])
print(num_max)
a,b,c,d = map(int, input().split(" "))
maxi = max([a*c, a*d, b*c, b*d])
print(maxi)
import numpy as np
a, b, c, d = map(int, input().split())

hoge = []
hoge.append(a*c)
hoge.append(a*d)
hoge.append(b*c)
hoge.append(b*d)

print(max(hoge))
a,b,c,d = map(int, input().split())
print(max(a*c, a*d, b*c, b*d))
str = input().split()
a,b,c,d = [int(i) for i in str]

ans_list = [a * c, a * d, b * c, b * d]

print(max(ans_list))
import sys

def solve():
    A, B, C, D = [int(i) for i in input().split()]
    ans = sys.maxsize * -1
    X = [0, A, B] if A <= 0 <= B else [A, B]
    Y = [0, C, D] if A <= 0 <= B else [C, D]
    for x in X:
        for y in Y:
            ans = max(ans, x * y)
    print(ans)

if __name__ == "__main__":
    solve()
a, b, c, d = map(int, input().split())
e = a * c
f = a * d
g = b * c
h = b * d
print(max(e, f, g, h))
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    a, b, c, d = map(int,input().split())
    print(max(a*c,a*d,b*c,b*d))

if __name__=='__main__':
    main()
a, b, c, d = list(map(int, input().split()))
print(max(a*c, b*c, a*d, b*d))
a,b,c,d = map(int,input().split())
ac = a*c
bc = b*c
ad = a*d
bd = b*d
print(max([ac,bc,ad,bd]))
a, b, c, d = map(int, input().split())
ans = max(a*c , a*d, b*c, b*d)
print(ans)
a, b, c, d = map(int, input().split())
x = [a, min(a+1, b), max(a, b-1), b]
y = [c, min(c+1, d), max(c, d-1), d]

ans = -int(1e19)
for i in x:
  for j in y:
    ans = max(ans, i*j)
print(ans)
a,b,c,d=map(int,input().split())
A=a*c
B=a*d
C=b*c
D=b*d
N=[A,B,C,D]
print(max(N))
a,b,c,d=map(int,input().split())
x=max(a*c,b*d)
y=max(a*d,b*c)
print(max(x,y))
a, b, c, d =map(int, input().split())

print(max(a*c,a*d,b*c,b*d))
a,b,c,d = map(int,input().split())
x = [a , b]
y = [c , d]
m = a*c
for i in x:
  for j in y:
    if i*j > m:
      m = i*j
print(m)
import sys
import itertools
# import numpy as np
import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import permutations
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
a, b, c, d = map(int, input().split())

ans = -INF
for x in [a, b]:
    for y in [c,d]:
        ans = max(ans, x * y)
print(ans)
# 2020/09/13
# AtCoder Beginner Contest 178 - B

# Input
a, b, c, d = map(int,input().split())

# Calc
ans = max(a*c, a*d, b*c, b*d)

# Output
print(ans)
import math

a,b,c,d=map(int,input().split())


print(max(max(a,b)*max(c,d),min(a,b)*max(c,d),max(a,b)*min(c,d),min(a,b)*min(c,d)))
a, b, c, d = list(map(int, input().split()))

print(max([a*c, a*d, b*c, b*d]))
a,b,c,d = map(int,input().split())
x = [a,b]
y = [c,d]

if a * b < 0:
    x.append(-1)
    x.append(1)
    
if c * d < 0:
    y.append(-1)
    y.append(1)
    
ans = - (10 ** 20)
    
for i in x:
    for j in y:
        ans = max((i*j),ans)
        
print(ans)
n = list(map(int,input().split()))

a =n[0]*n[2]
b =n[0]*n[3]
c =n[1]*n[2]
d =n[1]*n[3]

x = max(a,b,c,d)

print(x)
a, b, c, d = map(int, input().split())

ac = a * c
ad = a * d
bc = b * c
bd = b * d

ans = max(ac, ad, bc, bd)

print(ans)
l = list(map(int,input().split()))
mx = float('-inf')

for i in range(2):
  for j in range(2,4):
    mx = max(mx,l[i]*l[j])
print(mx)
a,b,c,d = map(int, input().split())
array = []
array.append(a*c)
array.append(b*d)
array.append(a*d)
array.append(b*c)
if (a <= 0 and b >= 0) or (c <= 0 and d >= 0):
    array.append(0)
print(max(array))
from sys import stdin,stdout
# n=int(stdin.readline())
a,b,c,d=list(map(int,stdin.readline().split()))
ans=max(a*c,a*d,b*c,b*d)
print(ans)
a, b, c, d = map(int, input().split())
X = [a, b]
Y = [c, d]
lst = [[x*y for x in X] for y in Y]
mylist=[]
for i in lst:
    for I in i:
        mylist.append(I)

mylist.sort()
print(mylist[-1])
a,b,c,d=map(int,input().split())

xy=[a*c,a*d,b*c,b*d]
print(max(xy))