Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. 
Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. 
Chef recently learned about ratios and proportions. He wrote some positive integers a, b, c, d on a paper. Chef wants to know whether he can shuffle these numbers so as to make some proportion? Formally, four numbers x, y, z, w are said to make a proportion if ratio of x : y is same as that of z : w.

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

Only line of the input contains four space separated positive integers - a, b, c, d.

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

Print "Possible" if it is possible to shuffle a, b, c, d to make proportion, otherwise "Impossible" (without quotes).

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

$1 ≤ a, b, c, d  ≤ 1000$

----- Sample Input 1 ------ 
1 2 4 2
----- Sample Output 1 ------ 
Possible
----- explanation 1 ------ 
By swapping 4 and the second 2, we get 1 2 2 4. Note that 1 2 2 4 make proportion as 1 : 2 = 2 : 4. Hence answer is "Possible"

Difficulty: EASY
Tags: Complete search
Skill types: Complete search

Starter code:

Solutions:
li = list(map(int, input().split()))
li.sort()
print('Possible' if li[0] / li[1] == li[2] / li[3] else 'Impossible')


l = [int(x) for x in input().split(' ')]
l.sort()
print('Possible') if l[0] * l[3] == l[1] * l[2] else print('Impossible')


(a, b, c, d) = map(int, input().split())
if a / b == c / d or a / b == d / c:
	print('Possible')
elif b / a == c / d or b / a == d / c:
	print('Possible')
elif a / c == b / d or a / c == d / b:
	print('Possible')
elif c / a == b / d or c / a == d / b:
	print('Possible')
elif a / d == b / c or a / d == c / b:
	print('Possible')
elif d / a == b / c or d / a == c / b:
	print('Possible')
else:
	print('Impossible')


a = sorted(list(map(int, input().split())))
print('Possible' if a[0] / a[2] == a[1] / a[3] else 'Impossible')


(a, b, c, d) = map(int, input().split())
c1 = a * b == c * d
c2 = a * c == b * d
c3 = a * d == b * c
if c1 or c2 or c3:
	print('Possible ')
else:
	print('Impossible')


l = list(map(int, input().split()))
l.sort()
if l[0] * l[2] == l[1] * l[3] or l[0] * l[3] == l[1] * l[2]:
	print('Possible')
else:
	print('Impossible')


x = input().split()
l = []
for i in x:
	i = int(i)
	l.append(i)
ll = []
m = 0
for i in range(len(l)):
	for f in range(len(l)):
		for j in range(len(l)):
			for k in range(len(l)):
				if i not in ll:
					ll.append(i)
				if f not in ll:
					ll.append(f)
				if j not in ll:
					ll.append(j)
				if k not in ll:
					ll.append(k)
				if len(ll) == len(l):
					a = []
					for h in ll:
						a.append(l[h])
					if a[0] / a[1] == a[2] / a[3]:
						m = 1
			ll = []
if m == 1:
	print('Possible')
else:
	print('Impossible')


(w, x, y, z) = map(int, input().split())
if w * x == y * z or x * z == w * y or x * y == w * z:
	print('Possible')
else:
	print('Impossible')


l = list(map(int, input().split()))
l.sort()
a = l[0] / l[2]
b = l[1] / l[3]
if a == b:
	print('Possible')
else:
	print('Impossible')


l = list(map(int, input().split()))
l1 = l.sort()
if l[3] / l[2] == l[1] / l[0]:
	print('Possible')
elif l[2] / l[1] == l[1] / l[0]:
	print('Posiible')
else:
	print('Impossible')


(a, b, c, d) = map(int, input().split())
l = [a, b, c, d]
l1 = l.sort()
if l[3] / l[2] == l[1] / l[0]:
	print('Possible')
elif l[2] / l[1] == l[1] / l[0]:
	print('Posiible')
else:
	print('Impossible')


(a, b, c, d) = map(int, input().split())
listnos = [a, b, c, d]
min1 = min(listnos)
ind = listnos.index(min1)
listnos.pop(ind)
min2 = min(listnos)
ind2 = listnos.index(min2)
listnos.pop(ind2)
max2 = max(listnos)
ind3 = listnos.index(max2)
listnos.pop(ind3)
strrea = [min2, max2, min1, listnos[0]]
if strrea[1] / strrea[0] == strrea[3] / strrea[2]:
	print('Possible')
else:
	print('Impossible')


l = list(map(int, input().split()))
l.sort()
d = l[0] * l[3]
e = l[1] * l[2]
if d == e:
	print('Possible')
else:
	print('Impossible')


from itertools import permutations
numbers = list(map(int, input().split()))

def check_proportion(x, y, z, w):
	return x * w == y * z
for (x, y, z, w) in permutations(numbers, 4):
	if check_proportion(x, y, z, w):
		print('Possible')
		break
else:
	print('Impossible')


l = list(map(int, input().split()))
m1 = min(l)
m2 = max(l)
l.remove(m1)
l.remove(m2)
(a, b) = l
if a * b == m1 * m2:
	print('Possible')
else:
	print('Impossible')


(a, b, c, d) = map(int, input().split())
l = []
l.append(a)
l.append(b)
l.append(c)
l.append(d)
l.sort()
d = l[0] * l[3]
e = l[1] * l[2]
if d == e:
	print('Possible')
else:
	print('Impossible')


def solve():
	if a[0] / a[1] == a[2] / a[3]:
		return 'Possible'
	else:
		return 'Impossible'
a = list(map(int, input().split()))
a.sort()
print(solve())


(a, b, c, d) = sorted(list(map(int, input().split())))
if b / a == d / c or c / a == d / b or d / a == c / b:
	print('Possible')
else:
	print('Impossible')


import math
lis = list(map(int, input().split(' ')))
lis.sort()
if lis[0] / lis[1] == lis[2] / lis[3]:
	print('Possible')
else:
	print('Impossible')


a = [int(x) for x in input().split()]
a = sorted(a)
if a[0] / a[1] == a[2] / a[3]:
	print('Possible')
else:
	print('Impossible')


import os, sys, io, math
from re import *
from math import *
from array import *
from heapq import *
from bisect import *
from functools import *
from itertools import *
from statistics import *
from collections import *
I = lambda : [*map(int, sys.stdin.readline().split())]
IP = lambda : map(int, input().split())
IS = lambda : input()
IN = lambda : int(input())
IF = lambda : float(input())
l = I()
l.sort()
if l[0] / l[1] == l[2] / l[3]:
	print('Possible')
else:
	print('Impossible')


(a, b, c, d) = (int(item) for item in input().split())
if a * b == c * d or a * c == b * d or a * d == b * c:
	print('Possible')
else:
	print('Impossible')


(a, b, c, d) = sorted([int(x) for x in input().split()])
if a * d == c * b:
	print('Possible')
else:
	print('Impossible')


import sys
x = sorted(list(map(int, sys.stdin.readline().split())))
sys.stdout.write('Possible\n' if x[0] / x[2] == x[1] / x[3] or x[0] / x[1] == x[2] / x[3] else 'Impossible\n')


lst = list(map(int, input().split()))
lst.sort()
lst[1] = lst[1] / lst[0]
lst[0] = lst[0] / lst[0]
lst[3] = lst[3] / lst[2]
lst[2] = lst[2] / lst[2]
if lst[0] == lst[2] and lst[1] == lst[3]:
	print('Possible')
else:
	print('Impossible')


(a, b, c, d) = map(int, input().split())
ai = [a, b, c, d]
ai.sort()
if ai[0] / ai[1] == ai[2] / ai[3]:
	print('Possible')
else:
	print('Impossible')