A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show.

The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions:  Is it true that y is strictly larger than number x?  Is it true that y is strictly smaller than number x?  Is it true that y is larger than or equal to number x?  Is it true that y is smaller than or equal to number x? 

On each question the host answers truthfully, "yes" or "no".

Given the sequence of questions and answers, find any integer value of y that meets the criteria of all answers. If there isn't such value, print "Impossible".


-----Input-----

The first line of the input contains a single integer n (1 ≤ n ≤ 10000) — the number of questions (and answers). Next n lines each contain one question and one answer to it. The format of each line is like that: "sign x answer", where the sign is:  ">" (for the first type queries),  "<" (for the second type queries),  ">=" (for the third type queries),  "<=" (for the fourth type queries). 

All values of x are integer and meet the inequation  - 10^9 ≤ x ≤ 10^9. The answer is an English letter "Y" (for "yes") or "N" (for "no").

Consequtive elements in lines are separated by a single space.


-----Output-----

Print any of such integers y, that the answers to all the queries are correct. The printed number y must meet the inequation  - 2·10^9 ≤ y ≤ 2·10^9. If there are many answers, print any of them. If such value doesn't exist, print word "Impossible" (without the quotes).


-----Examples-----
Input
4
>= 1 Y
< 3 N
<= -3 N
> 55 N

Output
17

Input
2
> 100 Y
< -100 Y

Output
Impossible

Difficulty: MEDIUM
Tags: Amortized analysis

Implementation

Greedy algorithms
Skill types: Amortized analysis

Greedy algorithms

Starter code:

Solutions:
n = int(input())
(l, r) = (-1000000001, 1000000001)
for i in range(n):
	s = input().split()
	if s[2] == 'Y':
		if s[0] == '>':
			l = max(l, int(s[1]) + 1)
		elif s[0] == '>=':
			l = max(l, int(s[1]))
		elif s[0] == '<':
			r = min(r, int(s[1]) - 1)
		else:
			r = min(r, int(s[1]))
	elif s[0] == '<=':
		l = max(l, int(s[1]) + 1)
	elif s[0] == '<':
		l = max(l, int(s[1]))
	elif s[0] == '>=':
		r = min(r, int(s[1]) - 1)
	else:
		r = min(r, int(s[1]))
if r < l:
	print('Impossible')
elif r == 1000000001 and l == -1000000001:
	print(1)
elif r == 1000000001:
	print(l)
elif l == -1000000001:
	print(r)
else:
	print(r)


n = int(input())
ge = []
le = []
for i in range(n):
	(sign, num, out) = input().split()
	num = int(num)
	if out == 'Y':
		if sign == '>':
			ge.append(num + 1)
		elif sign == '>=':
			ge.append(num)
		elif sign == '<':
			le.append(num - 1)
		else:
			le.append(num)
	elif sign == '>':
		le.append(num)
	elif sign == '>=':
		le.append(num)
	elif sign == '<=':
		ge.append(num)
	else:
		ge.append(num)
import random
if len(ge) > 0 and len(le) > 0:
	if max(ge) > min(le):
		print('Impossible')
	elif max(ge) < min(le):
		print(random.randrange(max(ge), min(le)))
	else:
		print(min(le))
elif len(ge) == 0:
	print(min(le) - 1)
elif len(le) == 0:
	print(max(ge) + 1)


import sys
n = int(input())
arr = []
while n:
	txt = input()
	L = txt.split(' ')
	L[1] = int(L[1])
	arr.append(L)
	n -= 1
mx = 1000000001
mn = -1000000001
for L in arr:
	if L[0] == '>=':
		if L[2] == 'Y':
			mn = max(mn, L[1])
		else:
			mx = min(mx, L[1] - 1)
	elif L[0] == '<':
		if L[2] == 'Y':
			mx = min(mx, L[1] - 1)
		else:
			mn = max(mn, L[1])
	elif L[0] == '<=':
		if L[2] == 'Y':
			mx = min(mx, L[1])
		else:
			mn = max(mn, L[1] + 1)
	elif L[0] == '>':
		if L[2] == 'Y':
			mn = max(mn, L[1] + 1)
		else:
			mx = min(mx, L[1])
	else:
		pass
if mx < mn:
	print('Impossible')
else:
	print(mn)


def ugaday(lst):
	(l, r) = (-2000000000, 2000000000)
	for elem in lst:
		if elem[0] == '>':
			if elem[2] == 'N':
				r = min(r, int(elem[1]))
			else:
				l = max(l, int(elem[1]) + 1)
		if elem[0] == '<':
			if elem[2] == 'N':
				l = max(l, int(elem[1]))
			else:
				r = min(r, int(elem[1]) - 1)
		if elem[0] == '>=':
			if elem[2] == 'Y':
				l = max(l, int(elem[1]))
			else:
				r = min(r, int(elem[1]) - 1)
		if elem[0] == '<=':
			if elem[2] == 'Y':
				r = min(r, int(elem[1]))
			else:
				l = max(l, int(elem[1]) + 1)
	if l <= r:
		return l
	return 'Impossible'
n = int(input())
a = list()
for i in range(n):
	(s, x, ans) = [i for i in input().split()]
	a.append([s, x, ans])
print(ugaday(a))


from random import randint
n = int(input())
(l, r) = (-2 * 10 ** 9, 2 * 10 ** 9)
opposite = {'<': '>=', '<=': '>', '>': '<=', '>=': '<'}
for _ in range(n):
	(rel, num, ans) = input().split()
	num = int(num)
	if ans == 'N':
		rel = opposite[rel]
	if rel == '<':
		r = min(r, num - 1)
	elif rel == '<=':
		r = min(r, num)
	elif rel == '>':
		l = max(l, num + 1)
	elif rel == '>=':
		l = max(l, num)
if l > r:
	print('Impossible')
else:
	print(randint(l, r))


minimum = -2000000000
maximum = 2000000000
n = int(input())
while n > 0:
	n -= 1
	entrada = input().split()
	q = entrada[0]
	num = int(entrada[1])
	result = entrada[2]
	if q == '>' and result == 'Y':
		minimum = max(minimum, num + 1)
	elif q == '>' and result == 'N':
		maximum = min(maximum, num)
	elif q == '>=' and result == 'Y':
		minimum = max(minimum, num)
	elif q == '>=' and result == 'N':
		maximum = min(maximum, num - 1)
	elif q == '<' and result == 'Y':
		maximum = min(maximum, num - 1)
	elif q == '<' and result == 'N':
		minimum = max(minimum, num)
	elif q == '<=' and result == 'Y':
		maximum = min(maximum, num)
	elif q == '<=' and result == 'N':
		minimum = max(minimum, num + 1)
if minimum <= maximum:
	print(minimum)
else:
	print('Impossible')


n = int(input())
mn = -2000000000
mx = 2000000000
for i in range(n):
	(znak, m, ans) = map(str, input().split())
	if znak == '>':
		if ans == 'Y':
			mn = max(mn, int(m) + 1)
		else:
			mx = min(mx, int(m))
	if znak == '<':
		if ans == 'Y':
			mx = min(mx, int(m) - 1)
		else:
			mn = max(mn, int(m))
	if znak == '>=':
		if ans == 'Y':
			mn = max(mn, int(m))
		else:
			mx = min(mx, int(m) - 1)
	if znak == '<=':
		if ans == 'Y':
			mx = min(mx, int(m))
		else:
			mn = max(mn, int(m) + 1)
if mx < mn:
	print('Impossible')
else:
	print((mx + mn) // 2)


N = int(input())
lb = float('-inf')
ub = float('+inf')

def flip(sign):
	if sign == '>=':
		return '<'
	if sign == '<':
		return '>='
	if sign == '>':
		return '<='
	if sign == '<=':
		return '>'
for _ in range(N):
	(sign, x, ans) = input().split(' ')
	x = int(x)
	if ans == 'N':
		(sign, ans) = (flip(sign), 'Y')
	assert ans == 'Y'
	if sign == '>=':
		lb = max(lb, x)
	if sign == '>':
		lb = max(lb, x + 1)
	if sign == '<=':
		ub = min(ub, x)
	if sign == '<':
		ub = min(ub, x - 1)
if lb <= ub:
	if lb == float('-inf'):
		print(ub)
	else:
		print(lb)
else:
	print('Impossible')


bAnswer = True
minv = -2000000000
maxv = 2000000000
for _ in range(int(input())):
	(s, d, c) = input().split()
	if s == '>=' and c == 'Y':
		if int(d) >= minv:
			minv = int(d)
	elif s == '>=' and c == 'N':
		if int(d) - 1 < maxv:
			maxv = int(d) - 1
	elif s == '>' and c == 'Y':
		if int(d) + 1 >= minv:
			minv = int(d) + 1
	elif s == '>' and c == 'N':
		if int(d) <= maxv:
			maxv = int(d)
	elif s == '<=' and c == 'Y':
		if int(d) <= maxv:
			maxv = int(d)
	elif s == '<=' and c == 'N':
		if int(d) + 1 >= minv:
			minv = int(d) + 1
	elif s == '<' and c == 'Y':
		if int(d) - 1 <= maxv:
			maxv = int(d) - 1
	elif s == '<' and c == 'N':
		if int(d) >= minv:
			minv = int(d)
	if minv > maxv:
		print('Impossible')
		bAnswer = False
		break
if bAnswer:
	print(minv)


n = int(input())
(i, j) = (-1000000001, 1000000001)
for _ in range(n):
	(s, v, a) = input().split()
	v = int(v)
	if (s, a) in [('>=', 'Y'), ('<', 'N')]:
		i = max(i, v)
	elif (s, a) in [('>', 'Y'), ('<=', 'N')]:
		i = max(i, v + 1)
	elif (s, a) in [('<=', 'Y'), ('>', 'N')]:
		j = min(j, v)
	elif (s, a) in [('<', 'Y'), ('>=', 'N')]:
		j = min(j, v - 1)
if i > j:
	print('Impossible')
else:
	print(i)


import sys
n = int(sys.stdin.readline())
instructions = []
max_const = 2000000000
min_const = -2000000000
for i in range(n):
	instructions.append(list(map(str, sys.stdin.readline().split())))
criteria = []
for i in instructions:
	if i[0] == '>' and i[2] == 'Y' or (i[0] == '<=' and i[2] == 'N'):
		criteria.append((int(i[1]) + 1, max_const))
	elif i[0] == '>=' and i[2] == 'Y' or (i[0] == '<' and i[2] == 'N'):
		criteria.append((int(i[1]), max_const))
	elif i[0] == '<' and i[2] == 'Y' or (i[0] == '>=' and i[2] == 'N'):
		criteria.append((min_const, int(i[1]) - 1))
	else:
		criteria.append((min_const, int(i[1])))
mini = min_const
maxi = max_const
for i in criteria:
	mini = max(mini, i[0])
	maxi = min(maxi, i[1])
if mini > maxi:
	print('Impossible')
else:
	print(mini)


def trocaSinal(s):
	if s == '>=':
		return '<'
	if s == '<=':
		return '>'
	if s == '>':
		return '<='
	if s == '<':
		return '>='
n = int(input())
s = [0] * n
for i in range(n):
	s[i] = input()
u = 2 * 10 ** 9
l = -2 * 10 ** 9
for i in range(n):
	t = s[i].split(' ')
	sinal = t[0]
	x = int(t[1])
	if t[2] == 'N':
		sinal = trocaSinal(sinal)
	if sinal == '>=':
		l2 = x
		l = max(l, l2)
	elif sinal == '>':
		l2 = x + 1
		l = max(l, l2)
	elif sinal == '<=':
		u2 = x
		u = min(u, u2)
	elif sinal == '<':
		u2 = x - 1
		u = min(u, u2)
if u >= l and abs(l) <= 2 * 10 ** 9:
	print(l)
else:
	print('Impossible')


def main():
	(lo, hi) = (-2000000000, 2000000001)
	for _ in range(int(input())):
		(s, x, yn) = input().split()
		if yn == 'N':
			s = {'<': '>=', '>': '<=', '<=': '>', '>=': '<'}[s]
		x = int(x) + 1 if s in ('<=', '>') else int(x)
		if s[0] == '<':
			if hi > x:
				hi = x
		elif lo < x:
			lo = x
	print((lo + hi) // 2 if lo < hi else 'Impossible')
main()


n = int(input())
k = 0
a = []
r = []
h = 0
for i in range(n):
	a.append(list(map(str, input().split())))
for i in range(n):
	for j in range(1):
		if a[i][j] == '>=' and a[i][j + 2] == 'Y':
			if k < int(a[i][j + 1]):
				k = int(a[i][j + 1])
		if a[i][j] == '>=' and a[i][j + 2] == 'N':
			if k >= int(a[i][j + 1]):
				k = int(a[i][j + 1]) - 1
		if a[i][j] == '>' and a[i][j + 2] == 'Y':
			if k <= int(a[i][j + 1]):
				k = int(a[i][j + 1]) + 1
		if a[i][j] == '>' and a[i][j + 2] == 'N':
			if k > int(a[i][j + 1]):
				k = int(a[i][j + 1])
		if a[i][j] == '<=' and a[i][j + 2] == 'Y':
			if k > int(a[i][j + 1]):
				k = int(a[i][j + 1])
		if a[i][j] == '<=' and a[i][j + 2] == 'N':
			if k <= int(a[i][j + 1]):
				k = int(a[i][j + 1]) + 1
		if a[i][j] == '<' and a[i][j + 2] == 'Y':
			if k >= int(a[i][j + 1]):
				k = int(a[i][j + 1]) - 1
		if a[i][j] == '<' and a[i][j + 2] == 'N':
			if k < int(a[i][j + 1]):
				k = int(a[i][j + 1])
for i in range(n):
	for j in range(1):
		if a[i][j] == '>=' and a[i][j + 2] == 'Y':
			if k >= int(a[i][j + 1]):
				r.append('+')
			else:
				r.append('-')
		if a[i][j] == '>=' and a[i][j + 2] == 'N':
			if k < int(a[i][j + 1]):
				r.append('+')
			else:
				r.append('-')
		if a[i][j] == '>' and a[i][j + 2] == 'Y':
			if k > int(a[i][j + 1]):
				r.append('+')
			else:
				r.append('-')
		if a[i][j] == '>' and a[i][j + 2] == 'N':
			if k <= int(a[i][j + 1]):
				r.append('+')
			else:
				r.append('-')
		if a[i][j] == '<=' and a[i][j + 2] == 'Y':
			if k <= int(a[i][j + 1]):
				r.append('+')
			else:
				r.append('-')
		if a[i][j] == '<=' and a[i][j + 2] == 'N':
			if k > int(a[i][j + 1]):
				r.append('+')
			else:
				r.append('-')
		if a[i][j] == '<' and a[i][j + 2] == 'Y':
			if k < int(a[i][j + 1]):
				r.append('+')
			else:
				r.append('-')
		if a[i][j] == '<' and a[i][j + 2] == 'N':
			if k >= int(a[i][j + 1]):
				r.append('+')
			else:
				r.append('-')
for i in range(len(r)):
	if r[i] == '-':
		print('Impossible')
		h = 0
		break
	else:
		h += 1
if h != 0:
	print(k)


from math import inf
n = int(input().strip())
start = -inf
end = inf
for i in range(n):
	query = list(input().strip().split())
	if query[0] == '>':
		if query[2] == 'Y':
			start = max(start, int(query[1]) + 1)
		else:
			end = min(end, int(query[1]))
	elif query[0] == '>=':
		if query[2] == 'Y':
			start = max(start, int(query[1]))
		else:
			end = min(end, int(query[1]) - 1)
	elif query[0] == '<':
		if query[2] == 'Y':
			end = min(end, int(query[1]) - 1)
		else:
			start = max(start, int(query[1]))
	elif query[0] == '<=':
		if query[2] == 'Y':
			end = min(end, int(query[1]))
		else:
			start = max(start, int(query[1]) + 1)
if start == -inf:
	print(end)
elif end == inf:
	print(start)
elif end - start >= 0:
	print(start)
else:
	print('Impossible')


n = int(input())
upper = 2 * 10 ** 9
lower = -2 * 10 ** 9
for i in range(0, n):
	guess = input().split(' ')
	if guess[0] == '>':
		if guess[2] == 'Y':
			lower = max(lower, int(guess[1]) + 1)
		else:
			upper = min(upper, int(guess[1]))
	elif guess[0] == '<':
		if guess[2] == 'Y':
			upper = min(upper, int(guess[1]) - 1)
		else:
			lower = max(lower, int(guess[1]))
	elif guess[0] == '>=':
		if guess[2] == 'Y':
			lower = max(lower, int(guess[1]))
		else:
			upper = min(upper, int(guess[1]) - 1)
	elif guess[0] == '<=':
		if guess[2] == 'Y':
			upper = min(upper, int(guess[1]))
		else:
			lower = max(lower, int(guess[1]) + 1)
if lower > upper:
	print('Impossible')
else:
	print(int((upper + lower) / 2))


n = int(input())
l = -2 * 10 ** 9
r = 2 * 10 ** 9
for i in range(n):
	(s, v, f) = input().split()
	v = int(v)
	if f == 'N':
		s = {'<': '>', '>': '<'}[s[0]] + s[1:]
		if len(s) == 1:
			s += '='
		else:
			s = s[0]
	if s[0] == '<':
		if len(s) != 2:
			v -= 1
		r = min(r, v)
	else:
		if len(s) != 2:
			v += 1
		l = max(l, v)
if l <= r:
	print(l)
else:
	print('Impossible')


def inverse(str):
	val = ''
	if str == '>':
		val = '<='
	elif str == '<':
		val = '>='
	elif str == '>=':
		val = '<'
	else:
		val = '>'
	return val
min_ = -2000000000
max_ = 2000000000
n = int(input())
for i in range(n):
	(sign, num, yn) = input().split()
	num = int(num)
	if yn == 'N':
		sign = inverse(sign)
	if sign == '<=':
		max_ = min(max_, num)
	elif sign == '<':
		max_ = min(max_, num - 1)
	elif sign == '>=':
		min_ = max(min_, num)
	else:
		min_ = max(min_, num + 1)
if min_ <= max_:
	print(min_)
else:
	print('Impossible')


n = int(input())
questions = []
for _ in range(n):
	(sign, x, answer) = list(map(str, input().split()))
	questions.append((sign, x, answer))
y_min = -1998638045
y_max = +1998638045
for question in questions:
	sign = question[0]
	x = int(question[1])
	answer = question[2]
	if sign == '>=' and answer == 'Y' or (sign == '<' and answer == 'N'):
		if x > y_min:
			y_min = x
	elif sign == '>' and answer == 'Y' or (sign == '<=' and answer == 'N'):
		if x + 1 > y_min:
			y_min = x + 1
	elif sign == '<=' and answer == 'Y' or (sign == '>' and answer == 'N'):
		if x < y_max:
			y_max = x
	elif sign == '<' and answer == 'Y' or (sign == '>=' and answer == 'N'):
		if x - 1 < y_max:
			y_max = x - 1
if y_max < y_min:
	print('Impossible')
else:
	print(y_min)


n = int(input())
m = [list(map(str, input().split())) for i in range(n)]
left = -2000000000
right = 2000000000
for i in range(n):
	c = int(m[i][1])
	if m[i][0] == '>' and m[i][2] == 'Y' or (m[i][0] == '<=' and m[i][2] == 'N'):
		if c + 1 > left:
			left = c + 1
	elif m[i][0] == '<' and m[i][2] == 'Y' or (m[i][0] == '>=' and m[i][2] == 'N'):
		if c - 1 < right:
			right = c - 1
	elif m[i][0] == '>=' and m[i][2] == 'Y' or (m[i][0] == '<' and m[i][2] == 'N'):
		if c > left:
			left = c
	elif c < right:
		right = c
if left > right:
	print('Impossible')
else:
	print(left)


import random as r
s = int(input())
mi = -2000000000
ma = 2000000000
for i in range(s):
	(x, y, z) = map(str, input().split())
	if z == 'Y':
		if len(x) == 1:
			if x[0] == '<':
				ma = min(ma, int(y) - 1)
			else:
				mi = max(mi, int(y) + 1)
		elif x[0] == '<':
			ma = min(ma, int(y))
		else:
			mi = max(mi, int(y))
	if z == 'N':
		if len(x) == 1:
			if x[0] == '>':
				ma = min(ma, int(y))
			else:
				mi = max(mi, int(y))
		elif x[0] == '>':
			ma = min(ma, int(y) - 1)
		else:
			mi = max(mi, int(y) + 1)
if mi > ma:
	print('Impossible')
else:
	print(mi)


_ = int(input())
mini = -10 ** 9 - 1
maxi = 10 ** 9 + 1
for i in range(_):
	(s, n, a) = input().split()
	n = int(n)
	if a == 'Y':
		if s == '>=':
			mini = max(mini, n)
		elif s == '>':
			mini = max(mini, n + 1)
		elif s == '<=':
			maxi = min(maxi, n)
		elif s == '<':
			maxi = min(maxi, n - 1)
	elif s == '>=':
		maxi = min(maxi, n - 1)
	elif s == '>':
		maxi = min(maxi, n)
	elif s == '<=':
		mini = max(mini, n + 1)
	elif s == '<':
		mini = max(mini, n)
if maxi >= mini:
	print(mini)
else:
	print('Impossible')


def main():
	n = int(input())
	small_less = int(2000000000.0) + 1
	big_great = int(-2000000000.0) - 1
	flip = {'>': '<', '<': '>'}
	for _ in range(n):
		(kind, num, ans) = input().split()
		num = int(num)
		if ans == 'N':
			had_eq = len(kind) == 2
			kind = flip[kind[0]]
			if not had_eq:
				kind += '='
		if kind == '<=':
			kind = '<'
			num += 1
		elif kind == '>=':
			kind = '>'
			num -= 1
		if kind == '<':
			small_less = min(small_less, num)
		else:
			big_great = max(big_great, num)
	if small_less - 1 <= big_great:
		print('Impossible')
	else:
		print(small_less - 1)
main()


(u, v) = (-2000000000, 2000000000)
for i in range(int(input())):
	(a, b, c) = input().split()
	k = int(b)
	if a == '>=':
		if c == 'Y':
			u = max(u, k)
		else:
			v = min(v, k - 1)
	elif a == '>':
		if c == 'Y':
			u = max(u, k + 1)
		else:
			v = min(v, k)
	elif a == '<=':
		if c == 'Y':
			v = min(v, k)
		else:
			u = max(u, k + 1)
	elif c == 'Y':
		v = min(v, k - 1)
	else:
		u = max(u, k)
print('Impossible' if u > v else u)


t = int(input())
u = []
l = []
for j in range(t):
	x = input().split()
	if x[0] == '>=' and x[2] == 'Y' or (x[0] == '<' and x[2] == 'N'):
		l.append(int(x[1]))
	elif x[0] == '<=' and x[2] == 'Y' or (x[0] == '>' and x[2] == 'N'):
		u.append(int(x[1]))
	elif x[0] == '>' and x[2] == 'Y' or (x[0] == '<=' and x[2] == 'N'):
		l.append(int(x[1]) + 1)
	else:
		u.append(int(x[1]) - 1)
u.sort()
l.sort(reverse=True)
if u == []:
	print(l[0])
elif l == []:
	print(u[0])
elif l[0] <= u[0]:
	print(l[0])
else:
	print('Impossible')


n = int(input())
left = -2 * 1000 * 1000 * 1000
right = 2 * 1000 * 1000 * 1000
for i in range(n):
	s = input().split()
	r = s[0]
	x = int(s[1])
	a = s[2]
	if 'Y' == a:
		if '>=' == r:
			left = max(left, x)
		if '>' == r:
			left = max(left, x + 1)
		if '<=' == r:
			right = min(right, x)
		if '<' == r:
			right = min(right, x - 1)
	else:
		if '<' == r:
			left = max(left, x)
		if '<=' == r:
			left = max(left, x + 1)
		if '>' == r:
			right = min(right, x)
		if '>=' == r:
			right = min(right, x - 1)
if left <= right:
	print(left)
else:
	print('Impossible')


questions = int(input())
(lower_limit, upper_limit) = (-2000000000, 2000000000)
inequalities = {'>': 2, '>=': 1, '<': -1, '<=': -2}
(gt, geq, lt, leq) = (2, 1, -1, -2)
for i in range(questions):
	(inequality, number, answer) = input().split()
	inequality = inequalities[inequality] * -1 if answer != 'Y' else inequalities[inequality]
	number = int(number) - 1 if inequality == lt else int(number) + 1 if inequality == gt else int(number)
	if inequality < 0 and upper_limit > number:
		upper_limit = number
	elif inequality > 0 and lower_limit < number:
		lower_limit = number
if lower_limit <= upper_limit:
	print(lower_limit)
else:
	print('Impossible')


n = int(input())
l = -float('inf')
r = float('inf')
kt = True
for i in range(n):
	temp = input().split()
	if temp[0] == '>':
		if temp[2] == 'Y':
			l = max(int(temp[1]) + 1, l)
		else:
			r = min(int(temp[1]), r)
	if temp[0] == '<':
		if temp[2] == 'Y':
			r = min(int(temp[1]) - 1, r)
		else:
			l = max(int(temp[1]), l)
	if temp[0] == '>=':
		if temp[2] == 'Y':
			l = max(int(temp[1]), l)
		else:
			r = min(int(temp[1]) - 1, r)
	if temp[0] == '<=':
		if temp[2] == 'Y':
			r = min(int(temp[1]), r)
		else:
			l = max(int(temp[1]) + 1, l)
	if l > r:
		kt = False
if kt == True:
	if l == float('-inf'):
		print(r)
	else:
		print(l)
else:
	print('Impossible')


n = int(input())
questions = []
for _ in range(n):
	questions.append(input())
(lower_bound, upper_bound) = (None, None)
for q in questions:
	bound = int(q.split()[1])
	if q.startswith('>') and q.endswith('Y') or (q.startswith('<') and q.endswith('N')):
		if 'Y' in q and '=' not in q or ('N' in q and '=' in q):
			bound += 1
		lower_bound = bound if lower_bound == None else max(bound, lower_bound)
	else:
		if 'Y' in q and '=' not in q or ('N' in q and '=' in q):
			bound -= 1
		upper_bound = bound if upper_bound == None else min(bound, upper_bound)
if lower_bound != None and upper_bound != None and (lower_bound > upper_bound):
	print('Impossible')
else:
	print(lower_bound if lower_bound != None else upper_bound)


from decimal import Decimal
l1 = int(input())
maximo = Decimal(2 * pow(10, 9))
minimo = Decimal(-2 * pow(10, 9))
for i in range(l1):
	l2 = input().split(' ')
	if l2[0] == '>' and l2[2] == 'Y':
		minimo = Decimal(max(minimo, Decimal(int(l2[1]) + 1)))
	elif l2[0] == '>' and l2[2] == 'N':
		maximo = Decimal(min(maximo, Decimal(int(l2[1]))))
	elif l2[0] == '>=' and l2[2] == 'Y':
		minimo = Decimal(max(minimo, Decimal(int(l2[1]))))
	elif l2[0] == '>=' and l2[2] == 'N':
		maximo = Decimal(min(maximo, Decimal(int(l2[1]) - 1)))
	elif l2[0] == '<' and l2[2] == 'Y':
		maximo = Decimal(min(maximo, Decimal(int(l2[1]) - 1)))
	elif l2[0] == '<' and l2[2] == 'N':
		minimo = Decimal(max(minimo, Decimal(int(l2[1]))))
	elif l2[0] == '<=' and l2[2] == 'Y':
		maximo = Decimal(min(maximo, Decimal(int(l2[1]))))
	elif l2[0] == '<=' and l2[2] == 'N':
		minimo = Decimal(max(minimo, Decimal(int(l2[1]) + 1)))
if minimo <= maximo:
	print(maximo)
else:
	print('Impossible')


__author__ = 'Lipen'

def ModeReverse(mode):
	if mode == '>':
		return '<='
	elif mode == '<':
		return '>='
	elif mode == '>=':
		return '<'
	elif mode == '<=':
		return '>'

def main():
	n = int(input())
	ymin = -2000000000
	ymax = 2000000000
	for i in range(n):
		(mode, x, ans) = input().split()
		x = int(x)
		if ans == 'N':
			mode = ModeReverse(mode)
		if mode == '>':
			ymin = max(ymin, x + 1)
		elif mode == '<':
			ymax = min(ymax, x - 1)
		elif mode == '>=':
			ymin = max(ymin, x)
		elif mode == '<=':
			ymax = min(ymax, x)
	if ymin > ymax:
		print('Impossible')
	else:
		print(ymin)
main()


T = int(input())
l = -2000000001
r = 2000000001
while T > 0:
	T -= 1
	(A, B, C) = input().split()
	b = int(B)
	if C == 'N':
		if A == '>=':
			A = '<'
		elif A == '<=':
			A = '>'
		elif A == '>':
			A = '<='
		else:
			A = '>='
	if A == '>=':
		b -= 1
	if A == '<=':
		b += 1
	if A[0] == '>':
		l = max(l, b)
	else:
		r = min(r, b)
if l + 1 >= r:
	print('Impossible')
else:
	print(l + 1)


n = int(input())
(a, b, c, d) = (-pow(10, 9) - 10, pow(10, 9) + 10, -pow(10, 9) - 10, pow(10, 9) + 10)
for _ in range(n):
	s = list(map(str, input().split()))
	if s[0] == '<' and s[2] == 'Y' or (s[0] == '>=' and s[2] == 'N'):
		b = min(int(s[1]), b)
	if s[0] == '>' and s[2] == 'Y' or (s[0] == '<=' and s[2] == 'N'):
		a = max(int(s[1]), a)
	if s[0] == '>=' and s[2] == 'Y' or (s[0] == '<' and s[2] == 'N'):
		c = max(int(s[1]), c)
	if s[0] == '<=' and s[2] == 'Y' or (s[0] == '>' and s[2] == 'N'):
		d = min(int(s[1]), d)
l = max(a + 1, c)
r = min(b - 1, d)
if a == -pow(10, 9) - 10 and b == pow(10, 9) + 10 and (c == -pow(10, 9) - 10) and (d == pow(10, 9) + 10):
	print('Impossible')
elif l > r:
	print('Impossible')
else:
	print(l)


n = int(input())
operations = ['>=', '<=', '>', '<']
NO = 'N'
M = 2 * 10 ** 9
greater = []
less = []
for i in range(n):
	inp = input().split(' ')
	if inp[0] == operations[0] and inp[2] == NO:
		inp[0] = operations[3]
	elif inp[0] == operations[1] and inp[2] == NO:
		inp[0] = operations[2]
	elif inp[0] == operations[2] and inp[2] == NO:
		inp[0] = operations[1]
	elif inp[0] == operations[3] and inp[2] == NO:
		inp[0] = operations[0]
	if inp[0] == operations[0]:
		greater.append(int(inp[1]) - 1)
	elif inp[0] == operations[2]:
		greater.append(int(inp[1]))
	elif inp[0] == operations[1]:
		less.append(int(inp[1]) + 1)
	elif inp[0] == operations[3]:
		less.append(int(inp[1]))
upper = 0
if len(greater) == 0:
	upper = -1 * M
else:
	upper = greater[0]
	for i in range(1, len(greater)):
		if greater[i] > upper:
			upper = greater[i]
lower = 0
if len(less) == 0:
	lower = M
else:
	lower = less[0]
	for i in range(1, len(less)):
		if less[i] < lower:
			lower = less[i]
if upper < -1 * M:
	upper = -1 * M
if lower > M:
	lower = M
if upper > lower - 2:
	print('Impossible')
else:
	print(upper + 1)


from random import randint

def guess_a_number(queries_str) -> str:
	lower_bound = -2 * pow(10, 9)
	upper_bound = 2 * pow(10, 9)
	for each in queries_str:
		query = each.split()
		relationship = query[0]
		bound = int(query[1])
		answer = query[2]
		if relationship == '>=' and answer == 'Y':
			if bound > lower_bound:
				lower_bound = bound
		elif relationship == '>=' and answer == 'N':
			if bound - 1 < upper_bound:
				upper_bound = bound - 1
		elif relationship == '>' and answer == 'Y':
			if bound + 1 > lower_bound:
				lower_bound = bound + 1
		elif relationship == '>' and answer == 'N':
			if bound < upper_bound:
				upper_bound = bound
		elif relationship == '<=' and answer == 'Y':
			if bound < upper_bound:
				upper_bound = bound
		elif relationship == '<=' and answer == 'N':
			if bound + 1 > lower_bound:
				lower_bound = bound + 1
		elif relationship == '<' and answer == 'Y':
			if bound - 1 < upper_bound:
				upper_bound = bound - 1
		elif relationship == '<' and answer == 'N':
			if bound > lower_bound:
				lower_bound = bound
		else:
			assert False, 'The query does NOT make sense!'
	if upper_bound < lower_bound:
		return 'Impossible'
	else:
		return str(randint(lower_bound, upper_bound))
n = int(input())
queries = [input() for i in range(n)]
print(guess_a_number(queries))


n = int(input())
(l, r) = (-1998638045, 11 ** 11)
for _ in range(n):
	(lr, x, yn) = input().split()
	x = int(x)
	if yn == 'Y':
		if lr == '>':
			if x + 1 > l:
				l = x + 1
		elif lr == '<':
			if x - 1 < r:
				r = x - 1
		elif lr == '>=':
			if x > l:
				l = x
		elif x < r:
			r = x
	elif lr == '>':
		if x < r:
			r = x
	elif lr == '<':
		if x > l:
			l = x
	elif lr == '>=':
		if x - 1 < r:
			r = x - 1
	elif x + 1 > l:
		l = x + 1
if l > r:
	print('Impossible')
else:
	print(l)


n = int(input())
top = 2 * 10 ** 9
bottom = -top
for i in range(n):
	line = input().split(' ')
	simb = line[0]
	num = int(line[1])
	answer = line[2]
	if answer == 'N':
		if simb == '>=':
			simb = '<'
		elif simb == '<=':
			simb = '>'
		elif simb == '>':
			simb = '<='
		elif simb == '<':
			simb = '>='
	if simb == '>=':
		bottom = max(bottom, num)
	elif simb == '<=':
		top = min(top, num)
	elif simb == '>':
		bottom = max(bottom, num + 1)
	elif simb == '<':
		top = min(top, num - 1)
if bottom > top:
	print('Impossible')
else:
	print(top)


t = int(input())
l = -2000000000
r = 2000000000
while t > 0:
	(zn, n, fl) = map(str, input().split())
	n = int(n)
	if fl == 'Y':
		if zn == '>':
			l = max(l, n + 1)
		elif zn == '<':
			r = min(r, n - 1)
		elif zn == '>=':
			l = max(l, n)
		elif zn == '<=':
			r = min(r, n)
	elif zn == '>':
		r = min(r, n)
	elif zn == '<':
		l = max(l, n)
	elif zn == '>=':
		r = min(r, n - 1)
	elif zn == '<=':
		l = max(l, n + 1)
	if r < l:
		print('Impossible')
		exit()
	t -= 1
print((l + r) // 2)


import sys
import math
import itertools
import collections

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def wr(arr):
	return ' '.join(map(str, arr))

def revn(n):
	return str(n)[::-1]

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base=3):
	newnumber = ''
	while number > 0:
		newnumber = str(number % base) + newnumber
		number //= base
	return newnumber
n = ii()
(l, r) = (-2 * 10 ** 9, 2 * 10 ** 9)
for i in range(n):
	p = list(input().split())
	if p[0] == '<=' and p[2] == 'Y' or (p[0] == '>' and p[2] == 'N'):
		r = min(r, int(p[1]))
	elif p[0] == '<=' and p[2] == 'N' or (p[0] == '>' and p[2] == 'Y'):
		l = max(l, int(p[1]) + 1)
	elif p[0] == '<' and p[2] == 'Y' or (p[0] == '>=' and p[2] == 'N'):
		r = min(r, int(p[1]) - 1)
	elif p[0] == '<' and p[2] == 'N' or (p[0] == '>=' and p[2] == 'Y'):
		l = max(l, int(p[1]))
if l <= r:
	print(l)
else:
	print('Impossible')


n = int(input())
maxnum = 10000000000
minnum = maxnum * -1
for _ in range(n):
	s = input().strip().split()
	if s[0] == '>':
		if s[2] == 'Y':
			minnum = int(s[1]) + 1 if minnum < int(s[1]) + 1 else minnum
		else:
			maxnum = int(s[1]) if maxnum > int(s[1]) else maxnum
	elif s[0] == '>=':
		if s[2] == 'Y':
			minnum = int(s[1]) if minnum < int(s[1]) else minnum
		else:
			maxnum = int(s[1]) - 1 if maxnum > int(s[1]) - 1 else maxnum
	elif s[0] == '<':
		if s[2] == 'Y':
			maxnum = int(s[1]) - 1 if maxnum > int(s[1]) - 1 else maxnum
		else:
			minnum = int(s[1]) if minnum < int(s[1]) else minnum
	elif s[0] == '<=':
		if s[2] == 'Y':
			maxnum = int(s[1]) if maxnum > int(s[1]) else maxnum
		else:
			minnum = int(s[1]) + 1 if minnum < int(s[1]) + 1 else minnum
if minnum > maxnum:
	print('Impossible')
elif minnum == maxnum:
	print(minnum)
elif maxnum < 0:
	print(maxnum)
elif minnum > 0:
	print(minnum)
else:
	print(0)


n = int(input())
maxr = 2 * 1000 * 1000 * 1000
minr = -maxr
for i in range(n):
	(con, x, ans) = input().split()
	x = int(x)
	if ans == 'N':
		if con == '>=':
			con = '<'
		elif con == '<=':
			con = '>'
		elif con == '<':
			con = '>='
		else:
			con = '<='
	if con == '>':
		minr = max(minr, x + 1)
	elif con == '>=':
		minr = max(minr, x)
	elif con == '<=':
		maxr = min(maxr, x)
	else:
		maxr = min(maxr, x - 1)
if minr <= maxr:
	print(minr)
else:
	print('Impossible')


import sys, itertools, math, collections, random

def ia():
	return [int(i) for i in sys.stdin.readline().strip().split(' ')]

def ii():
	return int(sys.stdin.readline().strip())

def istr():
	return sys.stdin.readline().strip()
OPS = ['>', '<', '<=', '>=']
nmin = -2 * 10 ** 9
nmax = 2 * 10 ** 9
for _ in range(ii()):
	(op, n, t) = istr().split(' ')
	n = int(n)
	if t == 'N':
		op = OPS[(OPS.index(op) + 2) % 4]
	if op == '>':
		nmin = max(n + 1, nmin)
	elif op == '>=':
		nmin = max(n, nmin)
	elif op == '<':
		nmax = min(n - 1, nmax)
	elif op == '<=':
		nmax = min(n, nmax)
if nmax < nmin:
	print('Impossible')
else:
	print(nmin)


from math import inf
bound = [-2 * 10 ** 9, 2 * 10 ** 9]
for i in range(int(input())):
	(x, y, z) = input().split()
	y = int(y)
	if x == '>' and z == 'Y':
		bound[0] = max(bound[0], y + 1)
	if x == '>' and z == 'N':
		bound[1] = min(bound[1], y)
	if x == '>=' and z == 'Y':
		bound[0] = max(bound[0], y)
	if x == '>=' and z == 'N':
		bound[1] = min(bound[1], y - 1)
	if x == '<' and z == 'Y':
		bound[1] = min(bound[1], y - 1)
	if x == '<' and z == 'N':
		bound[0] = max(bound[0], y)
	if x == '<=' and z == 'Y':
		bound[1] = min(bound[1], y)
	if x == '<=' and z == 'N':
		bound[0] = max(bound[0], y + 1)
print('Impossible' if bound[0] > bound[1] else bound[0])


import sys
n = int(input())
lower = -2 * 10 ** 9
upper = 2 * 10 ** 9
for i in range(n):
	(sign, x, ans) = input().split()
	x = int(x)
	if ans == 'Y' and sign == '>=' or (ans == 'N' and sign == '<'):
		lower = max(lower, x)
	elif ans == 'Y' and sign == '>' or (ans == 'N' and sign == '<='):
		lower = max(lower, x + 1)
	elif ans == 'Y' and sign == '<=' or (ans == 'N' and sign == '>'):
		upper = min(upper, x)
	else:
		upper = min(upper, x - 1)
	if lower > upper:
		print('Impossible')
		sys.exit()
print(lower)


n = int(input())
low_border = -10 ** 9 * 2
max_border = 10 ** 9 * 2

def replace_eq_if_nop(eq):
	return {'>': '<=', '>=': '<', '<': '>=', '<=': '>'}[eq]
for i in range(n):
	(eq, num, ans) = input().split()
	num = int(num)
	if ans == 'N':
		eq = replace_eq_if_nop(eq)
	if eq == '>':
		low_border = max(low_border, num + 1)
	elif eq == '>=':
		low_border = max(low_border, num)
	elif eq == '<':
		max_border = min(max_border, num - 1)
	elif eq == '<=':
		max_border = min(max_border, num)
if low_border > max_border:
	print('Impossible')
else:
	print(low_border)


from functools import reduce
from operator import *
from math import *
from sys import *
from string import *
from collections import *
setrecursionlimit(10 ** 7)
dX = [-1, 1, 0, 0, -1, 1, -1, 1]
dY = [0, 0, -1, 1, 1, -1, -1, 1]
RI = lambda : list(map(int, input().split()))
RS = lambda : input().rstrip().split()
n = RI()[0]
r = 2 * 10 ** 9
l = -r
inv = {'<=': '>', '>=': '<', '<': '>=', '>': '<='}
for i in range(n):
	(sign, x, a) = RS()
	x = int(x)
	if a == 'N':
		sign = inv[sign]
	if sign == '<=':
		r = min(x, r)
	elif sign == '>=':
		l = max(x, l)
	elif sign == '<':
		r = min(x - 1, r)
	else:
		l = max(x + 1, l)
print('Impossible' if l > r else l)


n = int(input())
Q = []
for i in range(0, n):
	Q.append(list(input().split()))
least = -1998638045
max = 1998638045
for q in Q:
	if q[0] is '>':
		num = int(q[1])
		if q[2] is 'Y':
			if least <= num:
				least = num + 1
		elif max >= num:
			max = num
	elif q[0] is '<':
		num = int(q[1])
		if q[2] is 'Y':
			if max >= num:
				max = num - 1
		elif least <= num:
			least = num
	elif q[0] == '>=':
		num = int(q[1])
		if q[2] is 'Y':
			if least <= num:
				least = num
		elif max >= num:
			max = num - 1
	elif q[0] == '<=':
		num = int(q[1])
		if q[2] is 'Y':
			if max >= num:
				max = num
		elif least <= num:
			least = num + 1
if least <= max:
	print(least)
else:
	print('Impossible')


n = int(input())
l = -2 * 10 ** 9
r = 2 * 10 ** 9
for i in range(n):
	s = input().split()
	s[1] = int(s[1])
	if s[2] == 'Y':
		if s[0] == '>=':
			l = max(l, s[1])
		elif s[0] == '>':
			l = max(l, s[1] + 1)
		elif s[0] == '<=':
			r = min(r, s[1])
		else:
			r = min(r, s[1] - 1)
	elif s[0] == '>=':
		r = min(r, s[1] - 1)
	elif s[0] == '>':
		r = min(r, s[1])
	elif s[0] == '<=':
		l = max(l, s[1] + 1)
	else:
		l = max(l, s[1])
if l > r:
	print('Impossible')
else:
	print(l)


n = int(input(''))
z = {}
ch = {}
tf = {}
for i in range(0, n):
	(z[i], ch[i], tf[i]) = map(str, input('').split())
	ch[i] = int(ch[i])
	if z[i] == '<':
		z[i] = int(1)
	if z[i] == '<=':
		z[i] = int(2)
	if z[i] == '>':
		z[i] = int(3)
	if z[i] == '>=':
		z[i] = int(4)
	if tf[i] == 'N':
		if z[i] == 1:
			z[i] = 4
		elif z[i] == 2:
			z[i] = 3
		elif z[i] == 3:
			z[i] = 2
		elif z[i] == 4:
			z[i] = 1
	if z[i] == 1:
		tf[i] = ch[i] - 1
	if z[i] == 3:
		tf[i] = ch[i] + 1
	if z[i] == 2 or z[i] == 4:
		tf[i] = ch[i]

def proverka(x, znak, oo):
	if znak == 1:
		if x < oo:
			return 1
		else:
			return 0
	elif znak == 2:
		if x <= oo:
			return 1
		else:
			return 0
	elif znak == 3:
		if x > oo:
			return 1
		else:
			return 0
	elif znak == 4:
		if x >= oo:
			return 1
		else:
			return 0
for i in range(0, n):
	l = 1
	for j in range(0, n):
		l *= proverka(tf[i], z[j], ch[j])
		if l == 0:
			break
	if l == 1:
		print(tf[i])
		exit(0)
print('Impossible')


(a, b) = (-(1 << 30), 1 << 30)
n = int(input())
for i in range(n):
	s = input().split()
	if s[0] == '>' and s[2] == 'Y' or (s[0] == '<=' and s[2] == 'N'):
		a = max(int(s[1]) + 1, a)
	elif s[0] == '>=' and s[2] == 'Y' or (s[0] == '<' and s[2] == 'N'):
		a = max(int(s[1]), a)
	elif s[0] == '<' and s[2] == 'Y' or (s[0] == '>=' and s[2] == 'N'):
		b = min(int(s[1]) - 1, b)
	else:
		b = min(int(s[1]), b)
if a > b:
	print('Impossible')
else:
	print(a)


n = int(input())
lis = []
for i in range(n):
	lis.append(input().split())
lis1 = []
lis2 = []
for i in range(n):
	if lis[i][0] == '>=':
		if lis[i][2] == 'Y':
			lis1.append(int(lis[i][1]))
		else:
			lis2.append(int(lis[i][1]) - 1)
	if lis[i][0] == '<=':
		if lis[i][2] == 'Y':
			lis2.append(int(lis[i][1]))
		else:
			lis1.append(int(lis[i][1]) + 1)
	if lis[i][0] == '>':
		if lis[i][2] == 'Y':
			lis1.append(int(lis[i][1]) + 1)
		else:
			lis2.append(int(lis[i][1]))
	if lis[i][0] == '<':
		if lis[i][2] == 'Y':
			lis2.append(int(lis[i][1]) - 1)
		else:
			lis1.append(int(lis[i][1]))
if lis1 == []:
	print(min(lis2))
elif lis2 == []:
	print(max(lis1))
else:
	a = max(lis1)
	b = min(lis2)
	if a <= b:
		print(a)
	else:
		print('Impossible')


left_border_inclusive = float('-inf')
right_border_inclusive = float('inf')
inverse_signs = {'>': '<=', '<=': '>', '>=': '<', '<': '>='}
NUMBERS = int(input())
EXTRA_FINISH = False
(sign, value) = (None, None)
for _ in range(NUMBERS):
	(sign, value, answer) = input().split(' ')
	value = int(value)
	if answer == 'N':
		sign = inverse_signs[sign]
	if sign == '>':
		if value >= right_border_inclusive:
			EXTRA_FINISH = True
			break
		left_border_inclusive = max(left_border_inclusive, value + 1)
	elif sign == '>=':
		if value > right_border_inclusive:
			EXTRA_FINISH = True
			break
		left_border_inclusive = max(left_border_inclusive, value)
	elif sign == '<':
		if value <= left_border_inclusive:
			EXTRA_FINISH = True
			break
		right_border_inclusive = min(right_border_inclusive, value - 1)
	elif sign == '<=':
		if value < left_border_inclusive:
			EXTRA_FINISH = True
			break
		right_border_inclusive = min(right_border_inclusive, value)
if not EXTRA_FINISH:
	if left_border_inclusive == float('-inf'):
		print(right_border_inclusive)
	else:
		print(left_border_inclusive)
else:
	print('Impossible')


def reverse(op):
	a = ['>=', '>', '<=', '<']
	b = ['<', '<=', '>', '>=']
	indx = a.index(op)
	return b[indx]
x = int(input())
minx = -2 * 10 ** 9
maxx = 2 * 10 ** 9
for i in range(x):
	guess = input().split(' ')
	if guess[2] == 'N':
		op = reverse(guess[0])
	else:
		op = guess[0]
	comp = int(guess[1])
	if op == '>=':
		minx = max(minx, comp)
	elif op == '>':
		minx = max(minx, comp + 1)
	elif op == '<=':
		maxx = min(maxx, comp)
	else:
		maxx = min(maxx, comp - 1)
if minx > maxx:
	print('Impossible')
else:
	print(minx)


n = int(input())
(l, r) = (-2000000000, 2000000000)
for i in range(n):
	s = input().split()
	if s[2] == 'N':
		if s[0] == '>':
			s[0] = '<='
		elif s[0] == '<':
			s[0] = '>='
		elif s[0] == '>=':
			s[0] = '<'
		elif s[0] == '<=':
			s[0] = '>'
	if s[0] == '>':
		l = max(l, int(s[1]) + 1)
	elif s[0] == '<':
		r = min(r, int(s[1]) - 1)
	elif s[0] == '>=':
		l = max(l, int(s[1]))
	elif s[0] == '<=':
		r = min(r, int(s[1]))
if l <= r:
	print(l)
else:
	print('Impossible')


n = int(input())
simbolo = []
num = []
yn = []
for j in range(n):
	(s, x, y) = input().split()
	simbolo.append(s)
	num.append(int(x))
	yn.append(y)
maximo = float('inf')
minimo = -float('inf')
for i in range(n):
	ismax = False
	if yn[i] == 'N':
		if simbolo[i] == '<':
			simbolo[i] = '>='
		elif simbolo[i] == '>':
			simbolo[i] = '<='
		elif simbolo[i] == '<=':
			simbolo[i] = '>'
		elif simbolo[i] == '>=':
			simbolo[i] = '<'
	if simbolo[i] == '<' or simbolo[i] == '<=':
		ismax = True
	if len(simbolo[i]) == 1:
		if ismax:
			num[i] -= 1
		else:
			num[i] += 1
	if ismax == True:
		if num[i] < maximo:
			maximo = num[i]
	elif num[i] > minimo:
		minimo = num[i]
if minimo == -float('inf'):
	minimo = maximo
if maximo >= minimo:
	print(minimo)
else:
	print('Impossible')


n = int(input())
m = 2 * 10 ** 9
d = [-m, m]
for i in range(n):
	(a, b, c) = input().split()
	b = int(b)
	if a == '>=':
		if c == 'Y':
			d[0] = max(d[0], b)
		else:
			d[1] = min(d[1], b - 1)
	elif a == '<':
		if c == 'Y':
			d[1] = min(d[1], b - 1)
		else:
			d[0] = max(d[0], b)
	elif a == '<=':
		if c == 'Y':
			d[1] = min(d[1], b)
		else:
			d[0] = max(d[0], b + 1)
	elif a == '>':
		if c == 'Y':
			d[0] = max(d[0], b + 1)
		else:
			d[1] = min(d[1], b)
if d[0] > d[1]:
	print('Impossible')
else:
	print(int(d[0]))


n = int(input().strip())
r = 2 * 10 ** 9
l = -r

def opp(ineq):
	if ineq == '<':
		return '>='
	elif ineq == '<=':
		return '>'
	elif ineq == '>':
		return '<='
	return '<'
for i in range(n):
	(ineq, val, ans) = input().strip().split(' ')
	if val[0] == '-':
		val = -1 * int(val[1:])
	else:
		val = int(val)
	if ans == 'N':
		ineq = opp(ineq)
	if ineq == '<':
		r = min(r, val - 1)
	elif ineq == '<=':
		r = min(r, val)
	elif ineq == '>':
		l = max(l, val + 1)
	else:
		l = max(l, val)
if l > r:
	print('Impossible')
else:
	print(l + r >> 1)


n = int(input())
r = [-(10 ** 9 + 7), 10 ** 9 + 7]
for _ in range(0, n):
	(s, x, a) = map(str, input().split())
	if a == 'Y':
		if s == '>=':
			r[0] = max(r[0], int(x))
		elif s == '>':
			r[0] = max(r[0], int(x) + 1)
		elif s == '<=':
			r[1] = min(r[1], int(x))
		elif s == '<':
			r[1] = min(r[1], int(x) - 1)
	if a == 'N':
		if s == '>=':
			r[1] = min(r[1], int(x) - 1)
		elif s == '>':
			r[1] = min(r[1], int(x))
		elif s == '<=':
			r[0] = max(r[0], int(x) + 1)
		elif s == '<':
			r[0] = max(r[0], int(x))
if r[0] <= r[1]:
	print(r[0])
else:
	print('Impossible')


list1 = ['', '', '', '']
n = int(input())
for _ in range(n):
	list2 = [x for x in input().split()]
	val = int(list2[1])
	if list2[2] == 'N':
		if list2[0] == '>=':
			list2[0] = '<'
		elif list2[0] == '>':
			list2[0] = '<='
		elif list2[0] == '<=':
			list2[0] = '>'
		elif list2[0] == '<':
			list2[0] = '>='
	if list2[0] == '>=':
		if list1[1] == '':
			list1[0] = '['
			list1[1] = val
		elif list1[1] <= val:
			list1[1] = val
			list1[0] = '['
	elif list2[0] == '>':
		if list1[1] == '':
			list1[0] = '('
			list1[1] = val
		elif list1[1] <= val:
			list1[1] = val
			list1[0] = '('
	elif list2[0] == '<=':
		if list1[2] == '':
			list1[3] = ']'
			list1[2] = val
		elif list1[2] >= val:
			list1[2] = val
			list1[3] = ']'
	elif list2[0] == '<':
		if list1[2] == '':
			list1[3] = ')'
			list1[2] = val
		elif list1[2] >= val:
			list1[2] = val
			list1[3] = ')'
if list1[0] == '(':
	list1[1] += 1
if list1[3] == ')':
	list1[2] -= 1
if list1[0] == '' or list1[3] == '':
	if list1[0] == '':
		print(list1[2])
	else:
		print(list1[1])
elif list1[1] > list1[2]:
	print('Impossible')
else:
	print(list1[1])


import math, sys
from collections import defaultdict, deque
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')

def I():
	return int(sys.stdin.readline())

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

def Sn():
	return sys.stdin.readline().strip()

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		n = I()
		(low, high) = (-P, P)
		for i in range(n):
			Q = Sn().split()
			if Q[-1] == 'Y':
				if Q[0] == '>':
					low = max(low, int(Q[1]) + 1)
				elif Q[0] == '>=':
					low = max(low, int(Q[1]))
				if Q[0] == '<':
					high = min(high, int(Q[1]) - 1)
				elif Q[0] == '<=':
					high = min(high, int(Q[1]))
			if Q[-1] == 'N':
				if Q[0] == '<':
					low = max(low, int(Q[1]))
				elif Q[0] == '<=':
					low = max(low, int(Q[1]) + 1)
				if Q[0] == '>':
					high = min(high, int(Q[1]))
				elif Q[0] == '>=':
					high = min(high, int(Q[1]) - 1)
		if high < low:
			print('Impossible')
		else:
			print(low)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(1):
	main()


def revOP(op):
	if op == '<':
		return '>='
	if op == '<=':
		return '>'
	if op == '>':
		return '<='
	if op == '>=':
		return '<'
n = int(input())
left = -2 * 10 ** 9
right = 2 * 10 ** 9
for i in range(n):
	arr = list(map(str, input().split()))
	num = int(arr[1])
	oper = arr[0]
	if arr[2] == 'N':
		oper = revOP(oper)
	if oper == '>=':
		if left < num:
			left = num
	elif oper == '>':
		if left < num + 1:
			left = num + 1
	elif oper == '<=':
		if right > num:
			right = num
	elif oper == '<':
		if right > num - 1:
			right = num - 1
if left <= right:
	print(left)
else:
	print('Impossible')


import sys
from math import *
input = sys.stdin.readline
RI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
rw = lambda : input().strip().split()
ls = lambda : list(input().strip())
from collections import defaultdict as df
import heapq
infinite = float('inf')
n = int(input())
l = -2 * 1000000000
r = +2 * 1000000000
f = 0
for i in range(n):
	(a, b, c) = input().strip().split()
	b = int(b)
	if a == '>':
		if c == 'Y':
			l = max(l, b + 1)
		else:
			r = min(b, r)
	elif a == '>=':
		if c == 'Y':
			l = max(l, b)
		else:
			r = min(r, b - 1)
	elif a == '<':
		if c == 'Y':
			r = min(r, b - 1)
		else:
			l = max(l, b)
	elif a == '<=':
		if c == 'Y':
			r = min(r, b)
		else:
			l = max(l, b + 1)
	if l > r:
		print('Impossible')
		f = 1
		break
if f == 0:
	print(l)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
queries = int(input())
MAX_L = -2000000000
MAX_R = 2000000000
start = MAX_L
end = MAX_R
for i in range(queries):
	query = input()
	(operator, n, res) = query.split()
	number = int(n)
	result = False
	if res == 'Y':
		result = True
	if result:
		if operator == '>':
			start = max(start, number + 1)
		elif operator == '>=':
			start = max(start, number)
		elif operator == '<':
			end = min(end, number - 1)
		else:
			end = min(end, number)
	elif operator == '>':
		end = min(end, number)
	elif operator == '>=':
		end = min(end, number - 1)
	elif operator == '<':
		start = max(start, number)
	else:
		start = max(start, number + 1)
possible = True
if start > end or end < MAX_L or start > MAX_R:
	possible = False
start = max(MAX_L, start)
end = min(MAX_R, end)
if not possible:
	print('Impossible')
else:
	print(start)


def main():
	n = int(input())
	(l, r) = (int(-2000000000.0), int(2000000000.0))
	for i in range(n):
		(s, x, a) = input().split(' ')
		if s == '>=' and a == 'Y' or (s == '<' and a == 'N'):
			l = max(l, int(x))
		if s == '<=' and a == 'Y' or (s == '>' and a == 'N'):
			r = min(r, int(x))
		if s == '>' and a == 'Y' or (s == '<=' and a == 'N'):
			l = max(l, int(x) + 1)
		if s == '<' and a == 'Y' or (s == '>=' and a == 'N'):
			r = min(r, int(x) - 1)
	if l <= r:
		return l
	return 'Impossible'
print(main())


n = int(input())
_min = -2 * 10 ** 9
_max = 2 * 10 ** 9
for q in range(n):
	(t, n, ans) = input().split()
	if t == '>':
		if ans == 'Y':
			_min = max(_min, int(n) + 1)
		elif ans == 'N':
			_max = min(_max, int(n))
	elif t == '>=':
		if ans == 'Y':
			_min = max(_min, int(n))
		elif ans == 'N':
			_max = min(_max, int(n) - 1)
	elif t == '<':
		if ans == 'Y':
			_max = min(_max, int(n) - 1)
		elif ans == 'N':
			_min = max(_min, int(n))
	elif t == '<=':
		if ans == 'Y':
			_max = min(_max, int(n))
		elif ans == 'N':
			_min = max(_min, int(n) + 1)
if _min > _max:
	print('Impossible')
else:
	print(_min)


def arr_2d(n):
	return [[str(x) for x in stdin.readline().split()] for i in range(n)]

def flip(x):
	if x == '<=':
		x = '>'
	elif x == '>=':
		x = '<'
	elif x == '<':
		x = '>='
	else:
		x = '<='
	return x
from sys import stdin
from random import randint
(n, mi, ma) = (int(input()), -2000000000, 2000000000)
a = arr_2d(n)
for (op, num, ans) in a:
	num = int(num)
	if ans == 'N':
		op = flip(op)
	if op == '>=':
		mi = max(num, mi)
	elif op == '>':
		mi = max(num + 1, mi)
	elif op == '<=':
		ma = min(num, ma)
	else:
		ma = min(num - 1, ma)
print(randint(mi, ma) if ma >= mi else 'Impossible')


n = int(input())
l1 = [-2 * 10 ** 9, 2 * 10 ** 9]
for i in range(n):
	inp = list(input().split())
	if inp[0] == '>':
		x = int(inp[1])
		if inp[2] == 'Y':
			l1[0] = max(l1[0], x + 1)
		else:
			l1[1] = min(l1[1], x)
	elif inp[0] == '<':
		x = int(inp[1])
		if inp[2] == 'N':
			l1[0] = max(l1[0], x)
		else:
			l1[1] = min(l1[1], x - 1)
	elif inp[0] == '<=':
		x = int(inp[1])
		if inp[2] == 'N':
			l1[0] = max(l1[0], x + 1)
		else:
			l1[1] = min(l1[1], x)
	elif inp[0] == '>=':
		x = int(inp[1])
		if inp[2] == 'Y':
			l1[0] = max(l1[0], x)
		else:
			l1[1] = min(l1[1], x - 1)
if l1[0] <= l1[1]:
	print(l1[0])
else:
	print('Impossible')


n = int(input())
li = []
for i in range(n):
	s = list(input().split(' '))
	li.append(s)
mx = 2 * 10 ** 9
mi = -mx
for i in range(n):
	if li[i][2] == 'Y':
		if li[i][0] == '>':
			mi = max(mi, int(li[i][1]) + 1)
		elif li[i][0] == '>=':
			mi = max(mi, int(li[i][1]))
		elif li[i][0] == '<':
			mx = min(mx, int(li[i][1]) - 1)
		else:
			mx = min(mx, int(li[i][1]))
	elif li[i][0] == '>':
		mx = min(mx, int(li[i][1]))
	elif li[i][0] == '>=':
		mx = min(mx, int(li[i][1]) - 1)
	elif li[i][0] == '<':
		mi = max(mi, int(li[i][1]))
	else:
		mi = max(mi, int(li[i][1]) + 1)
if mi > mx:
	print('Impossible')
else:
	print(mx)


n = int(input())
l = -10 ** 9 - 1
r = 10 ** 9 + 1
while n > 0:
	n -= 1
	s = input().split()
	if len(s[0]) == 1:
		if s[0] == '>':
			if s[2] == 'Y':
				l = max(l, int(s[1]) + 1)
			else:
				r = min(r, int(s[1]))
		elif s[2] == 'Y':
			r = min(int(s[1]) - 1, r)
		else:
			l = max(int(s[1]), l)
	elif s[0] == '>=':
		if s[2] == 'Y':
			l = max(l, int(s[1]))
		else:
			r = min(r, int(s[1]) - 1)
	elif s[2] == 'Y':
		r = min(int(s[1]), r)
	else:
		l = max(int(s[1]) + 1, l)
if l <= r:
	print(l)
else:
	print('Impossible')


n = int(input())
low = -float('inf')
high = float('inf')
for _ in range(n):
	(sign, x, ans) = input().split()
	x = int(x)
	if sign == '>=':
		if ans == 'Y':
			low = max(low, x)
		else:
			high = min(high, x - 1)
	elif sign == '>':
		if ans == 'Y':
			low = max(low, x + 1)
		else:
			high = min(high, x)
	elif sign == '<=':
		if ans == 'Y':
			high = min(high, x)
		else:
			low = max(low, x + 1)
	elif ans == 'Y':
		high = min(high, x - 1)
	else:
		low = max(low, x)
if low > high:
	print('Impossible')
elif low != -float('inf'):
	print(low)
else:
	print(high)


left = -2000000000
right = 2000000000
for _ in range(int(input())):
	temp = input().split()
	sign = temp[0]
	n = int(temp[1])
	tf = temp[2]
	if tf == 'Y':
		if sign == '>' and left <= n:
			left = n + 1
		elif sign == '>=' and left < n:
			left = n
		elif sign == '<' and right >= n:
			right = n - 1
		elif sign == '<=' and right > n:
			right = n
	elif tf == 'N':
		if sign == '>' and right > n:
			right = n
		elif sign == '>=' and right >= n:
			right = n - 1
		elif sign == '<' and left < n:
			left = n
		elif sign == '<=' and left <= n:
			left = n + 1
if left <= right:
	print(left)
else:
	print('Impossible')


n_questions = int(input())
min_threshold = -2000000000
max_threshold = 2000000000

def inverted(condition):
	if condition == '<':
		return '>='
	elif condition == '<=':
		return '>'
	elif condition == '>':
		return '<='
	return '<'
for i in range(n_questions):
	(condition, number, is_true) = input().split()
	number = int(number)
	if is_true == 'N':
		condition = inverted(condition)
	if condition == '<' and max_threshold > number - 1:
		max_threshold = number - 1
	elif condition == '<=' and max_threshold > number:
		max_threshold = number
	elif condition == '>' and min_threshold < number + 1:
		min_threshold = number + 1
	elif condition == '>=' and min_threshold < number:
		min_threshold = number
if min_threshold <= max_threshold:
	print(min_threshold)
else:
	print('Impossible')


n = int(input())
low = -2000000001
high = 2000000001
i = 0
flag = 0
while i < n:
	i = i + 1
	lis = input().split()
	if lis[2] == 'N':
		if lis[0] == '>':
			lis[0] = '<='
		elif lis[0] == '<':
			lis[0] = '>='
		elif lis[0] == '<=':
			lis[0] = '>'
		elif lis[0] == '>=':
			lis[0] = '<'
	if lis[0] == '>':
		if low < int(lis[1]) + 1:
			low = int(lis[1]) + 1
	elif lis[0] == '>=':
		if low < int(lis[1]):
			low = int(lis[1])
	elif lis[0] == '<':
		if high > int(lis[1]) - 1:
			high = int(lis[1]) - 1
	elif lis[0] == '<=':
		if high > int(lis[1]):
			high = int(lis[1])
	if low > high:
		flag = 1
		break
if flag == 1:
	print('Impossible')
else:
	ans = low + high
	ans = ans // 2
	print(ans)


(l, h) = (-2000000000, 2000000000)
for _ in range(int(input())):
	(x, y, z) = [_ for _ in input().split()]
	y = int(y)
	if x == '<=':
		if z == 'Y':
			if h > y:
				h = y
		elif l < y:
			l = y + 1
	if x == '<':
		if z == 'Y':
			if h > y - 1:
				h = y - 1
		elif l < y:
			l = y
	if x == '>=':
		if z == 'Y':
			if l < y:
				l = y
		elif h > y - 1:
			h = y - 1
	if x == '>':
		if z == 'Y':
			if l < y + 1:
				l = y + 1
		elif h > y:
			h = y
if l > h:
	print('Impossible')
else:
	print(l)


import sys
import math
n = int(input())
k1 = -2 * 10 ** 9
k2 = 2 * 10 ** 9
for i in range(n):
	st = sys.stdin.readline().split()
	if st[2] == 'N':
		if st[0] == '>':
			st[0] = '<='
		elif st[0] == '<':
			st[0] = '>='
		elif st[0] == '<=':
			st[0] = '>'
		elif st[0] == '>=':
			st[0] = '<'
	if st[0] == '>=':
		if int(st[1]) > k1:
			k1 = int(st[1])
	elif st[0] == '>':
		if int(st[1]) + 1 > k1:
			k1 = int(st[1]) + 1
	elif st[0] == '<=':
		if int(st[1]) < k2:
			k2 = int(st[1])
	elif st[0] == '<':
		if int(st[1]) - 1 < k2:
			k2 = int(st[1]) - 1
if k1 > k2:
	print('Impossible')
else:
	print(k1)


n = int(input())
l = 0
fl = True
r = 0
fr = True
for i in range(n):
	(t, x, ans) = input().split()
	x = int(x)
	if t == '>=' and ans == 'Y':
		if x > l or fl:
			l = x
			fl = False
	elif t == '>=' and ans == 'N':
		if x - 1 < r or fr:
			r = x - 1
			fr = False
	elif t == '<=' and ans == 'Y':
		if x < r or fr:
			r = x
			fr = False
	elif t == '<=' and ans == 'N':
		if x + 1 > l or fl:
			l = x + 1
			fl = False
	elif t == '>' and ans == 'Y':
		if x + 1 > l or fl:
			l = x + 1
			fl = False
	elif t == '>' and ans == 'N':
		if x < r or fr:
			r = x
			fr = False
	elif t == '<' and ans == 'Y':
		if x - 1 < r or fr:
			r = x - 1
			fr = False
	elif t == '<' and ans == 'N':
		if x > l or fl:
			l = x
			fl = False
if fl == True and fr == True:
	print(0)
elif fl == True and fr != True:
	print(r)
elif fl != True and fr == True:
	print(l)
elif r < l:
	print('Impossible')
else:
	print(l)


n = int(input())
u = 10 ** 9 + 1
l = -u
for i in range(n):
	s = input().split()
	if s[0] == '>=':
		if s[2] == 'Y':
			l = max(l, int(s[1]))
		else:
			u = min(u, int(s[1]) - 1)
	if s[0] == '>':
		if s[2] == 'Y':
			l = max(l, int(s[1]) + 1)
		else:
			u = min(u, int(s[1]))
	if s[0] == '<=':
		if s[2] == 'N':
			l = max(l, int(s[1]) + 1)
		else:
			u = min(u, int(s[1]))
	if s[0] == '<':
		if s[2] == 'N':
			l = max(l, int(s[1]))
		else:
			u = min(u, int(s[1]) - 1)
if l > u:
	print('Impossible')
else:
	print(u)


n = int(input())
k = -2000000000
l = 2000000000
for x in range(n):
	(a, z, b) = input().split()
	a = a
	z = int(z)
	b = b
	if a == '>' and b == 'Y' and (k < z + 1):
		k = z + 1
	elif a == '>=' and b == 'Y' and (k < z):
		k = z
	elif a == '>' and b == 'N' and (l > z):
		l = z
	elif a == '>=' and b == 'N' and (l > z - 1):
		l = z - 1
	elif a == '<' and b == 'Y' and (l > z - 1):
		l = z - 1
	elif a == '<=' and b == 'Y' and (l > z):
		l = z
	elif a == '<' and b == 'N' and (k < z):
		k = z
	elif a == '<=' and b == 'N' and (k < z + 1):
		k = z + 1
if k <= l:
	print(k)
else:
	print('Impossible')


d = {'> Y': (0, 1, max), '>= Y': (0, 0, max), '< N': (0, 0, max), '<= N': (0, 1, max), '< Y': (1, -1, min), '<= Y': (1, 0, min), '> N': (1, 0, min), '>= N': (1, -1, min)}
ran = [-2000000000, 2000000000]
possible = True

def analyse(s):
	ls = s.split(' ')
	op = d.get(' '.join((ls[0], ls[2])))
	ran[op[0]] = op[2](int(ls[1]) + op[1], ran[op[0]])
n = int(input())
for i in range(n):
	s = input()
	if possible:
		analyse(s)
		if ran[0] > ran[1]:
			possible = False
if possible:
	print(ran[0])
else:
	print('Impossible')


def main():
	li = -10000000000.0
	ul = 10000000000.0
	n = int(input())
	for _ in range(n):
		(sym, guess, ans) = input().split()
		if sym == '>=':
			if ans == 'Y' and int(guess) > li:
				li = int(guess)
			elif ans == 'N' and int(guess) < ul:
				ul = int(guess) - 1
		elif sym == '>':
			if ans == 'Y' and int(guess) >= li:
				li = int(guess) + 1
			elif ans == 'N' and int(guess) < ul:
				ul = int(guess)
		elif sym == '<=':
			if ans == 'Y' and int(guess) < ul:
				ul = int(guess)
			elif ans == 'N' and int(guess) > li:
				li = int(guess) + 1
		elif sym == '<':
			if ans == 'Y' and int(guess) <= ul:
				ul = int(guess) - 1
			elif ans == 'N' and int(guess) > li:
				li = int(guess)
	if li <= ul:
		if abs(li - 0) < abs(ul - 0):
			print(int(li))
		else:
			print(int(ul))
	else:
		print('Impossible')
main()


n = int(input())
a = 2 * 10 ** 9
b = -(2 * 10 ** 9)
for i in range(n):
	arr = [i for i in input().split()]
	arr[1] = int(arr[1])
	if '>=' in arr:
		if arr[2] == 'Y':
			b = max(b, arr[1])
		else:
			a = min(a, arr[1] - 1)
	if '<=' in arr:
		if arr[2] == 'Y':
			a = min(a, arr[1])
		else:
			b = max(b, arr[1] + 1)
	if '<' in arr:
		if arr[2] == 'Y':
			a = min(a, arr[1] - 1)
		else:
			b = max(b, arr[1])
	if '>' in arr:
		if arr[2] == 'Y':
			b = max(b, arr[1] + 1)
		else:
			a = min(a, arr[1])
if b > a:
	print('Impossible')
else:
	print(b)


n = int(input())
(lower_range, upper_range) = (-1000000001, 1000000001)
for i in range(n):
	(operation, num, correct) = input().split(' ')
	num = int(num)
	if operation[0] == '>':
		if correct == 'Y':
			if num >= lower_range:
				if len(operation) > 1:
					lower_range = num
				else:
					lower_range = num + 1
		elif num < upper_range:
			if len(operation) > 1:
				upper_range = num - 1
			else:
				upper_range = num
	if operation[0] == '<':
		if correct == 'Y':
			if num <= upper_range:
				if len(operation) > 1:
					upper_range = num
				else:
					upper_range = num - 1
		elif num > lower_range:
			if len(operation) > 1:
				lower_range = num + 1
			else:
				lower_range = num
if lower_range > upper_range:
	print('Impossible')
else:
	print(lower_range)


from random import randint
inf = 2 * 10 ** 9

def main():
	n = int(input())
	(lt, rt) = (-inf, inf)
	opposite = {'<': '>=', '<=': '>', '>': '<=', '>=': '<'}
	for i in range(n):
		(a, b, c) = input().split()
		b = int(b)
		if c == 'N':
			a = opposite[a]
		if a == '<':
			rt = min(rt, b - 1)
		elif a == '<=':
			rt = min(rt, b)
		elif a == '>':
			lt = max(lt, b + 1)
		elif a == '>=':
			lt = max(lt, b)
	if lt > rt:
		print('Impossible')
	else:
		print(randint(lt, rt))
main()


n = int(input())
l = -10 ** 9 - 3
r = 10 ** 9 + 3
for i in range(n):
	(sign, x, ans) = map(str, input().split())
	x = int(x)
	if sign == '>' and ans == 'Y' or (sign == '<=' and ans == 'N'):
		if l <= x:
			l = x + 1
	elif sign == '<' and ans == 'Y' or (sign == '>=' and ans == 'N'):
		if r >= x:
			r = x - 1
	elif sign == '>=' and ans == 'Y' or (sign == '<' and ans == 'N'):
		if x > l:
			l = x
	elif sign == '<=' and ans == 'Y' or (sign == '>' and ans == 'N'):
		if x < r:
			r = x
if l <= r:
	print(l)
else:
	print('Impossible')


n = int(input())
y = [-2 * 10 ** 9, 2 * 10 ** 9]
k = []
f = 0
for i in range(n):
	k.append(list(map(str, input().split())))
for i in range(n):
	x = int(k[i][1])
	if k[i][2] == 'N':
		if k[i][0] == '>':
			k[i][0] = '<='
		elif k[i][0] == '>=':
			k[i][0] = '<'
		elif k[i][0] == '<':
			k[i][0] = '>='
		else:
			k[i][0] = '>'
	if k[i][0] == '>':
		y[0] = max(x + 1, y[0])
	elif k[i][0] == '<':
		y[1] = min(x - 1, y[1])
	elif k[i][0] == '<=':
		y[1] = min(x, y[1])
	else:
		y[0] = max(x, y[0])
	if y[0] > y[1]:
		f = 1
		break
if f:
	print('Impossible')
else:
	print(y[0])


n = int(input())
l = -10 ** 9 - 1
r = 10 ** 9 + 1
for _ in range(n):
	(x, y, z) = input().split()
	x = str(x)
	y = int(y)
	z = str(z)
	if z == 'Y':
		if x == '>=':
			if y > l:
				l = y
		elif x == '>':
			if y >= l:
				l = y + 1
		elif x == '<=':
			if y < r:
				r = y
		elif y <= r:
			r = y - 1
	elif x == '<':
		if y > l:
			l = y
	elif x == '<=':
		if y >= l:
			l = y + 1
	elif x == '>':
		if y < r:
			r = y
	elif y <= r:
		r = y - 1
if l > r:
	print('Impossible')
else:
	print((l + r) // 2)


f = 0
import sys
st = -sys.maxsize
end = sys.maxsize
for _ in range(int(input())):
	s = input()
	import sys
	(a, b, c) = s.split()
	if c == 'N':
		if a == '>':
			a = '<='
		elif a == '<':
			a = '>='
		elif a == '>=':
			a = '<'
		elif a == '<=':
			a = '>'
		c = 'Y'
	if a == '<':
		end = min(end, int(b) - 1)
	elif a == '<=':
		end = min(end, int(b))
	elif a == '>':
		st = max(st, int(b) + 1)
	elif a == '>=':
		st = max(st, int(b))
	if st > end:
		f = 1
if f == 1:
	print('Impossible')
else:
	print((st + end) // 2)


n = int(input())
a = -2 * 10 ** 9
b = 2 * 10 ** 9
for i in range(n):
	s = input().split()
	x = int(s[1])
	ans = str(s[2])
	s = s[0]
	if s == '>=':
		if ans == 'Y':
			a = max(a, x)
		else:
			b = min(b, x - 1)
	elif s == '<=':
		if ans == 'Y':
			b = min(b, x)
		else:
			a = max(a, x + 1)
	elif s == '<':
		if ans == 'Y':
			b = min(b, x - 1)
		else:
			a = max(x, a)
	elif s == '>':
		if ans == 'Y':
			a = max(a, x + 1)
		else:
			b = min(x, b)
if b < a:
	print('Impossible')
else:
	print(b)


num = int(input())
first = 0
result = 0
possible = True
maxi = 2 * 10 ** 9
mini = -2 * 10 ** 9
for i in range(num):
	str = input()
	str = str.split()
	symbol = str[0]
	number = int(str[1])
	order = str[2]
	if symbol == '>':
		if order == 'Y':
			mini = max(mini, number + 1)
		else:
			maxi = min(maxi, number + 1)
	elif symbol == '<':
		if order == 'Y':
			maxi = min(maxi, number - 1)
		else:
			mini = max(mini, number)
	elif symbol == '>=':
		if order == 'Y':
			mini = max(mini, number)
		else:
			maxi = min(maxi, number - 1)
	elif symbol == '<=':
		if order == 'Y':
			maxi = min(maxi, number)
		else:
			mini = max(mini, number + 1)
if mini > maxi:
	print('Impossible')
else:
	print(mini)


n = int(input())
low = -2 * 10 ** 9
high = 2 * 10 ** 9
for i in range(n):
	(sign, x, answer) = input().split()
	x = int(x)
	if sign == '>=':
		if answer == 'Y':
			low = max(low, x)
		else:
			high = min(high, x - 1)
	elif sign == '>':
		if answer == 'Y':
			low = max(low, x + 1)
		else:
			high = min(high, x)
	elif sign == '<=':
		if answer == 'Y':
			high = min(high, x)
		else:
			low = max(low, x + 1)
	elif answer == 'Y':
		high = min(high, x - 1)
	else:
		low = max(low, x)
if low <= high:
	print(low)
else:
	print('Impossible')


n = int(input())
s = []
for i in range(n):
	(ef, fr, efw) = list(map(str, input().split()))
	fr = int(fr)
	s.append([ef, fr, efw])
ODZmax = 2 * 10 ** 9
ODZmin = -(2 * 10 ** 9)
for i in range(n):
	if s[i][0] == '>=' and s[i][2] == 'Y':
		if ODZmin < s[i][1]:
			ODZmin = s[i][1]
	elif s[i][0] == '>=' and s[i][2] == 'N':
		if ODZmax > s[i][1] - 1:
			ODZmax = s[i][1] - 1
	elif s[i][0] == '>' and s[i][2] == 'N':
		if ODZmax > s[i][1]:
			ODZmax = s[i][1]
	elif s[i][0] == '>' and s[i][2] == 'Y':
		if ODZmin < s[i][1] + 1:
			ODZmin = s[i][1] + 1
	elif s[i][0] == '<' and s[i][2] == 'N':
		if ODZmin < s[i][1]:
			ODZmin = s[i][1]
	elif s[i][0] == '<' and s[i][2] == 'Y':
		if ODZmax > s[i][1] - 1:
			ODZmax = s[i][1] - 1
	if s[i][0] == '<=' and s[i][2] == 'Y':
		if ODZmax > s[i][1]:
			ODZmax = s[i][1]
	elif s[i][0] == '<=' and s[i][2] == 'N':
		if ODZmin < s[i][1] + 1:
			ODZmin = s[i][1] + 1
if ODZmin > ODZmax:
	print('Impossible')
else:
	print(ODZmin)


n = int(input())
ma = 'a'
mi = 'b'
for i in range(n):
	linha = input()
	linha = linha.split()
	if linha[0] == '<=' and linha[2] == 'Y' or (linha[0] == '>' and linha[2] == 'N'):
		maior = int(linha[1])
		if ma == 'a':
			ma = maior
		else:
			ma = min(ma, maior)
	elif linha[0] == '<' and linha[2] == 'Y' or (linha[0] == '>=' and linha[2] == 'N'):
		maior = int(linha[1]) - 1
		if ma == 'a':
			ma = maior
		else:
			ma = min(ma, maior)
	elif linha[0] == '>' and linha[2] == 'Y' or (linha[0] == '<=' and linha[2] == 'N'):
		menor = int(linha[1]) + 1
		if mi == 'b':
			mi = menor
		else:
			mi = max(mi, menor)
	elif linha[0] == '>=' and linha[2] == 'Y' or (linha[0] == '<' and linha[2] == 'N'):
		menor = int(linha[1])
		if mi == 'b':
			mi = menor
		else:
			mi = max(mi, menor)
if ma == 'a':
	print(mi)
elif mi == 'b':
	print(ma)
elif mi > ma:
	print('Impossible')
else:
	print(mi)


n = int(input())
left = -10 ** 9 - 5
right = 10 ** 9 + 5
for i in range(n):
	(op, x, ans) = input().split()
	x = int(x)
	if op == '>' and ans == 'Y':
		left = max(x + 1, left)
	elif op == '>':
		right = min(x, right)
	if op == '<' and ans == 'Y':
		right = min(x - 1, right)
	elif op == '<':
		left = max(x, left)
	if op == '>=' and ans == 'Y':
		left = max(x, left)
	elif op == '>=':
		right = min(x - 1, right)
	if op == '<=' and ans == 'Y':
		right = min(x, right)
	elif op == '<=':
		left = max(x + 1, left)
if right < left:
	print('Impossible')
else:
	print(left)


nop = {'<': '>=', '>': '<=', '<=': '>', '>=': '<'}
(vmin, vmax) = (-(10 ** 9 + 1), 10 ** 9 + 1)
for i in range(int(input())):
	q = input().split()
	(op, x) = (q[0] if q[2] == 'Y' else nop[q[0]], int(q[1]))
	if op[0] == '<':
		if op[-1] != '=':
			x -= 1
		vmax = min(vmax, x)
	elif op[0] == '>':
		if op[-1] != '=':
			x += 1
		vmin = max(vmin, x)
print(vmin if vmin <= vmax else 'Impossible')


l = -2 * 1000000000
r = 2 * 1000000000
n = int(input())
f = 0
for i in range(n):
	(s1, s2, s3) = input().split()
	s2 = int(s2)
	if s1 == '<' and s3 == 'Y' or (s1 == '>=' and s3 == 'N'):
		if r >= s2:
			r = s2 - 1
	elif s1 == '>' and s3 == 'Y' or (s1 == '<=' and s3 == 'N'):
		if l <= s2:
			l = s2 + 1
	elif s1 == '<=' and s3 == 'Y' or (s1 == '>' and s3 == 'N'):
		if r > s2:
			r = s2
	elif s1 == '>=' and s3 == 'Y' or (s1 == '<' and s3 == 'N'):
		if l < s2:
			l = s2
if l <= r:
	print(l)
else:
	print('Impossible')


n = int(input())
i = -2 * 10 ** 9
j = 2 * 10 ** 9
while n > 0:
	(sign, x, ans) = input().split()
	x = int(x)
	if sign == '>':
		if ans == 'Y':
			if i < x + 1:
				i = x + 1
		elif j > x - 1:
			j = x
	elif sign == '>=':
		if ans == 'Y':
			if i < x:
				i = x
		elif j > x:
			j = x - 1
	elif sign == '<':
		if ans == 'Y':
			if j > x - 1:
				j = x - 1
		elif i < x + 1:
			i = x
	elif ans == 'Y':
		if j > x:
			j = x
	elif i < x:
		i = x + 1
	if i > j:
		break
	n -= 1
if i > j:
	print('Impossible')
else:
	print(i)


n = int(input())
(p1, p2) = (int(2 * -1000000000.0), int(2 * 1000000000.0))
for i in range(n):
	(q, x, a) = map(str, input().split())
	if a == 'Y':
		if q == '>=' and int(x) >= p1:
			p1 = int(x)
		elif q == '>' and int(x) >= p1:
			p1 = int(x) + 1
		elif q == '<=' and int(x) <= p2:
			p2 = int(x)
		elif q == '<' and int(x) <= p2:
			p2 = int(x) - 1
	elif a == 'N':
		if q == '>=' and int(x) <= p2:
			p2 = int(x) - 1
		elif q == '>' and int(x) <= p2:
			p2 = int(x)
		elif q == '<=' and int(x) >= p1:
			p1 = int(x) + 1
		elif q == '<' and int(x) >= p1:
			p1 = int(x)
if p1 > p2:
	print('Impossible')
else:
	print(p1)


(m, M) = (-2000000000, 2000000000)
n = int(input())
for i in range(n):
	(a, b, c) = map(str, input().split())
	b = int(b)
	if c == 'Y':
		if a == '>':
			m = max(b + 1, m)
		elif a == '>=':
			m = max(b, m)
		elif a == '<':
			M = min(b - 1, M)
		elif a == '<=':
			M = min(M, b)
	elif a == '>':
		M = min(b, M)
	elif a == '>=':
		M = min(b - 1, M)
	elif a == '<':
		m = max(m, b)
	else:
		m = max(b + 1, m)
if m > M:
	print('Impossible')
else:
	print(m)


class InputHandlerObject(object):
	inputs = []

	def getInput(self, n=0):
		res = ''
		inputs = self.inputs
		if not inputs:
			inputs.extend(input().split(' '))
		if n == 0:
			res = inputs[:]
			inputs[:] = []
		while n > len(inputs):
			inputs.extend(input().split(' '))
		if n > 0:
			res = inputs[:n]
			inputs[:n] = []
		return res
InputHandler = InputHandlerObject()
g = InputHandler.getInput
n = int(input().strip())
mn = -2 * 10 ** 9
mx = 2 * 10 ** 9
repl = [('>', '<='), ('>=', '<'), ('<=', '>'), ('<', '>=')]
for i in range(n):
	a = g()
	a[1] = int(a[1])
	if a[2] == 'N':
		for (qq, qqq) in repl:
			if qq == a[0]:
				a[0] = qqq
				break
	if a[0] == '>':
		a[1] += 1
	if a[0] == '<':
		a[1] -= 1
	if a[0][0] == '>':
		mn = max(mn, a[1])
	if a[0][0] == '<':
		mx = min(mx, a[1])
if mn <= mx:
	print(mn)
else:
	print('Impossible')


n = int(input())
min = -2000000000
max = 2000000000
for i in range(n):
	(op, val, b) = map(str, input().split())
	val = int(val)
	if op == '>=' and b == 'Y' or (op == '<' and b == 'N'):
		if val > min:
			min = val
	elif op == '<' and b == 'Y' or (op == '>=' and b == 'N'):
		if val - 1 < max:
			max = val - 1
	elif op == '<=' and b == 'Y' or (op == '>' and b == 'N'):
		if val < max:
			max = val
	elif op == '>' and b == 'Y' or (op == '<=' and b == 'N'):
		if val + 1 > min:
			min = val + 1
if min <= max:
	print(min)
else:
	print('Impossible')


n = int(input())
left = None
right = None
for i in range(n):
	st = input()
	(op, num, ans) = st.split(' ')
	num = int(num)
	if ans == 'N':
		if op == '>=':
			op = '<'
		elif op == '>':
			op = '<='
		elif op == '<=':
			op = '>'
		else:
			op = '>='
	if op == '>=':
		if left == None:
			left = num
		else:
			left = max(left, num)
	elif op == '>':
		if left == None:
			left = num + 1
		else:
			left = max(left, num + 1)
	elif op == '<=':
		if right == None:
			right = num
		else:
			right = min(right, num)
	elif right == None:
		right = num - 1
	else:
		right = min(right, num - 1)
if left == None and right == None:
	print(0)
elif left == None:
	print(right)
elif right == None:
	print(left)
elif left > right:
	print('Impossible')
else:
	print(left)


n = int(input())
MAX = 1000000000
(minimum, maximum, temp_max, temp_min) = [0] * 4
i = 0
while i < n:
	question = [x for x in input().split()]
	if question[2] == 'Y':
		if question[0] == '>=':
			minimum = int(question[1])
			maximum = MAX
		elif question[0] == '>':
			minimum = int(question[1]) + 1
			maximum = MAX
		elif question[0] == '<=':
			minimum = -MAX
			maximum = int(question[1])
		else:
			minimum = -MAX
			maximum = int(question[1]) - 1
	elif question[0] == '>=':
		minimum = -MAX
		maximum = int(question[1]) - 1
	elif question[0] == '>':
		minimum = -MAX
		maximum = int(question[1])
	elif question[0] == '<=':
		minimum = int(question[1]) + 1
		maximum = MAX
	else:
		minimum = int(question[1])
		maximum = MAX
	if i == 0:
		temp_max = maximum
		temp_min = minimum
	else:
		temp_max = min(temp_max, maximum)
		temp_min = max(temp_min, minimum)
		if temp_max < temp_min and abs(temp_min) <= MAX and (abs(temp_max) <= MAX):
			print('Impossible')
			exit()
	i += 1
if minimum != -MAX:
	print(temp_min)
else:
	print(temp_max)


try:
	n = int(input())
	(i, j) = (-1000000001, 1000000001)
	for k in range(n):
		(s, v, a) = input().split()
		v = int(v)
		if (s, a) in [('>=', 'Y'), ('<', 'N')]:
			i = max(i, v)
		elif (s, a) in [('>', 'Y'), ('<=', 'N')]:
			i = max(i, v + 1)
		elif (s, a) in [('<=', 'Y'), ('>', 'N')]:
			j = min(j, v)
		elif (s, a) in [('<', 'Y'), ('>=', 'N')]:
			j = min(j, v - 1)
	print('Impossible' if i > j else i)
except:
	pass


n = int(input())
l = []
less = []
grt = []
for i in range(n):
	l = [x for x in input().split()]
	if l[2] == 'N':
		l[2] = 'Y'
		if l[0] == '>=':
			l[0] = '<'
		elif l[0] == '>':
			l[0] = '<='
		elif l[0] == '<':
			l[0] = '>='
		else:
			l[0] = '>'
	if l[0] == '<' or l[0] == '<=':
		less.append(int(l[1]))
		if l[0] == '<':
			less[-1] -= 1
	elif l[0] == '>' or l[0] == '>=':
		grt.append(int(l[1]))
		if l[0] == '>':
			grt[-1] += 1
less.sort()
grt.sort()
if len(less) > 0 and len(grt) > 0:
	v1 = less[0]
	v2 = grt[-1]
	if v1 >= v2:
		print(v2)
	else:
		print('Impossible')
elif len(less) == 0 and len(grt) > 0:
	print(grt[-1])
elif len(grt) == 0 and len(less) > 0:
	print(less[0])
elif len(less) == 0 and len(grt) == 0:
	print('Impossible')


(l, r) = (-2000000000, 2000000000)
for x in range(int(input())):
	(t, n, a) = input().split()
	if t[0] == '>':
		n = int(n) + (len(t) == 1)
		if a == 'Y':
			l = max(l, n)
		else:
			r = min(r, n - 1)
	else:
		n = int(n) - (len(t) == 1)
		if a == 'Y':
			r = min(r, n)
		else:
			l = max(l, n + 1)
if l <= r:
	print((l + r) // 2)
else:
	print('Impossible')


n = int(input())
(m, M) = (-2000000000, 2000000000)

def than(a, more, eq):
	global m, M
	if more:
		m = max(m, a + 1 - eq)
	else:
		M = min(M, a - 1 + eq)
for i in range(n):
	(_a, _b, _c) = input().split()
	sign = _a
	number = int(_b)
	response = _c
	a = number
	eq = '=' in sign
	more = '>' in sign
	if response == 'N':
		eq = not eq
		more = not more
	than(a, more, eq)
if m <= M:
	print(m)
else:
	print('Impossible')


from enum import Enum
from collections import namedtuple

class Operator(Enum):
	LT = '<'
	LTE = '<='
	GT = '>'
	GTE = '>='

	def inverse(self):
		inverses = {self.LT: self.GTE, self.LTE: self.GT, self.GT: self.LTE, self.GTE: self.LT}
		return inverses[self]
Range = namedtuple('Range', ['op', 'number'])

def order_strictness_le_or_leq(a: Range):
	return (a.number, 0 if a.op == Operator.LT else 1)

def order_strictness_ge_or_geq(a: Range):
	return (a.number, 1 if a.op == Operator.GT else 0)
queries = int(input())
ranges_le_leq = [Range(op=Operator.LTE, number=2 * 10 ** 9)]
ranges_gt_gte = [Range(op=Operator.GTE, number=-2 * 10 ** 9)]
for i in range(queries):
	(operator, number, answer) = input().split()
	operator = Operator(operator)
	number = int(number)
	if answer == 'N':
		operator = operator.inverse()
	r = Range(op=operator, number=number)
	if operator in [Operator.LT, Operator.LTE]:
		ranges_le_leq.append(r)
	else:
		ranges_gt_gte.append(r)
most_strict_lt = min(ranges_le_leq, key=order_strictness_le_or_leq)
most_strict_gt = max(ranges_gt_gte, key=order_strictness_ge_or_geq)
gt_number = most_strict_gt.number
if most_strict_gt.op == Operator.GT:
	gt_number += 1
lt_number = most_strict_lt.number
if most_strict_lt.op == Operator.LT:
	lt_number -= 1
if gt_number > lt_number:
	print('Impossible')
else:
	print(gt_number)


n = int(input())
lt = lte = 2 * 10 ** 9
gt = gte = -2 * 10 ** 9
for _ in range(n):
	(t1, t2, t3) = input().split()
	t2 = int(t2)
	if t3 == 'Y':
		if t1 == '>=':
			gte = max(gte, t2)
		elif t1 == '>':
			gt = max(gt, t2)
		elif t1 == '<=':
			lte = min(lte, t2)
		else:
			lt = min(lt, t2)
	elif t1 == '>=':
		lt = min(lt, t2)
	elif t1 == '>':
		lte = min(lte, t2)
	elif t1 == '<=':
		gt = max(gt, t2)
	else:
		gte = max(gte, t2)
m1 = min(lt - 1, lte)
m2 = max(gt + 1, gte)
if m1 < m2:
	print('Impossible')
else:
	print((m1 + m2) // 2)


n = int(input())
li = -2 * 10 ** 9
ls = 2 * 10 ** 9
originales = ['>', '<', '>=', '<=']
inversos = ['<=', '>=', '<', '>']
for i in range(n):
	condi = input().split()
	if condi[2] == 'Y':
		if originales.index(condi[0]) % 2 == 0:
			if condi[0] == '>':
				if li <= int(condi[1]):
					li = int(condi[1]) + 1
			elif li < int(condi[1]):
				li = int(condi[1])
		elif condi[0] == '<':
			if ls >= int(condi[1]):
				ls = int(condi[1]) - 1
		elif ls > int(condi[1]):
			ls = int(condi[1])
	elif originales.index(condi[0]) % 2 == 0:
		if condi[0] == '>':
			if ls > int(condi[1]):
				ls = int(condi[1])
		elif ls >= int(condi[1]):
			ls = int(condi[1]) - 1
	elif condi[0] == '<':
		if li < int(condi[1]):
			li = int(condi[1])
	elif li <= int(condi[1]):
		li = int(condi[1]) + 1
if ls >= li:
	print(li)
else:
	print('Impossible')


n = int(input())
l = -2000000000
r = 2000000000
for _ in range(n):
	s = input().split()
	x = int(s[1])
	if s[0] == '>' and s[2] == 'Y':
		l = max(l, x + 1)
	elif s[0] == '>' and s[2] == 'N':
		r = min(r, x)
	elif s[0] == '>=' and s[2] == 'Y':
		l = max(l, x)
	elif s[0] == '>=' and s[2] == 'N':
		r = min(r, x - 1)
	elif s[0] == '<' and s[2] == 'Y':
		r = min(r, x - 1)
	elif s[0] == '<' and s[2] == 'N':
		l = max(l, x)
	elif s[0] == '<=' and s[2] == 'Y':
		r = min(r, x)
	elif s[0] == '<=' and s[2] == 'N':
		l = max(l, x + 1)
if r - l >= 0:
	print(l)
else:
	print('Impossible')


import collections, itertools, fractions, functools, heapq, math, queue

def solve():
	n = int(input())
	lo = -2 * 10 ** 9
	hi = -lo
	for _ in range(n):
		(cond, v, t) = input().split()
		v = int(v)
		if t == 'N':
			cond = {'>': '<=', '<': '>=', '>=': '<', '<=': '>'}[cond]
		if cond == '>':
			lo = max(lo, v + 1)
		if cond == '>=':
			lo = max(lo, v)
		if cond == '<':
			hi = min(hi, v - 1)
		if cond == '<=':
			hi = min(hi, v)
		if lo > hi:
			return 'Impossible'
	return lo
print(solve())


n = int(input())
(i, j) = (-1000000001, 1000000001)
for k in range(n):
	(e, x, a) = input().split()
	x = int(x)
	if (e, a) in [('>=', 'Y'), ('<', 'N')]:
		i = max(i, x)
	elif (e, a) in [('>', 'Y'), ('<=', 'N')]:
		i = max(i, x + 1)
	elif (e, a) in [('<=', 'Y'), ('>', 'N')]:
		j = min(j, x)
	elif (e, a) in [('<', 'Y'), ('>=', 'N')]:
		j = min(j, x - 1)
if i > j:
	print('Impossible')
else:
	print(i)


import re
import inspect
from sys import argv, exit

def rstr():
	return input()

def rint():
	return int(input())

def rints(splitchar=' '):
	return [int(i) for i in input().split(splitchar)]

def rstrs(splitchar=' '):
	return [i for i in input().split(splitchar)]

def varnames(obj, namespace=globals()):
	return [name for name in namespace if namespace[name] is obj]

def pvar(var, override=False):
	prnt(varnames(var), var)

def prnt(*args, override=False):
	if '-v' in argv or override:
		print(*args)
n = rint()
nmin = -10 ** 9 - 1
nmax = 10 ** 9 + 1
for i in range(n):
	tokens = rstrs()
	tokens[1] = int(tokens[1])
	if tokens[0] == '>=':
		if tokens[2] == 'Y':
			nmin = max(tokens[1], nmin)
		else:
			nmax = min(tokens[1] - 1, nmax)
	elif tokens[0] == '<=':
		if tokens[2] == 'N':
			nmin = max(tokens[1] + 1, nmin)
		else:
			nmax = min(tokens[1], nmax)
	elif tokens[0] == '>':
		if tokens[2] == 'Y':
			nmin = max(tokens[1] + 1, nmin)
		else:
			nmax = min(tokens[1], nmax)
	elif tokens[0] == '<':
		if tokens[2] == 'N':
			nmin = max(tokens[1], nmin)
		else:
			nmax = min(tokens[1] - 1, nmax)
	else:
		print('PANIC', tokens[0])
if nmin <= nmax:
	print(nmin)
else:
	print('Impossible')


n = int(input())
ma = 2 * 10 ** 9
mi = -2 * 10 ** 9
for i in range(n):
	x = input()
	if x[len(x) - 1] == 'Y':
		if x[0] == '<' and x[1] == '=':
			ma = min(ma, int(x[3:len(x) - 2]))
		elif x[0] == '<' and x[1] == ' ':
			if int(x[2:len(x) - 2]) >= 0:
				ma = min(ma, int(x[2:len(x) - 2]) - 1)
			else:
				ma = min(ma, int(x[2:len(x) - 2]) + 1)
		elif x[0] == '>' and x[1] == '=':
			mi = max(mi, int(x[3:len(x) - 2]))
		elif x[0] == '>' and x[1] == ' ':
			mi = max(mi, int(x[2:len(x) - 2]) + 1)
	if x[len(x) - 1] == 'N':
		if x[0] == '<' and x[1] == '=':
			mi = max(mi, int(x[2:len(x) - 2]) + 1)
		elif x[0] == '<' and x[1] == ' ':
			mi = max(mi, int(x[2:len(x) - 2]))
		elif x[0] == '>' and x[1] == '=':
			if int(x[2:len(x) - 2]) >= 0:
				ma = min(ma, int(x[2:len(x) - 2]) - 1)
			else:
				ma = min(ma, int(x[2:len(x) - 2]) + 1)
		elif x[0] == '>' and x[1] == ' ':
			ma = min(ma, int(x[2:len(x) - 2]))
if ma < mi:
	print('Impossible')
else:
	print(mi)


n = int(input())
mn = -2000000000
mx = 2000000000
for i in range(n):
	(sign, ber, ans) = input().split()
	num = int(ber)
	if ans == 'N':
		if sign == '<':
			sign = '>='
		elif sign == '<=':
			sign = '>'
		elif sign == '>':
			sign = '<='
		elif sign == '>=':
			sign = '<'
	if sign == '<':
		sign = '<='
		num -= 1
	if sign == '>':
		sign = '>='
		num += 1
	if sign == '<=':
		mx = min(mx, num)
	else:
		mn = max(mn, num)
if mx < mn:
	print('Impossible')
else:
	print(mn)


n = int(input())
p = -1000000001
l = 1000000001
for x in range(n):
	s = input().split()
	r = int(s[1])
	if s[2] == 'Y':
		if s[0] == '>=':
			p = max(p, r)
		if s[0] == '>':
			p = max(p, r + 1)
		if s[0] == '<=':
			l = min(l, r)
		if s[0] == '<':
			l = min(l, r - 1)
	else:
		if s[0] == '<':
			p = max(p, r)
		if s[0] == '<=':
			p = max(p, r + 1)
		if s[0] == '>':
			l = min(l, r)
		if s[0] == '>=':
			l = min(l, r - 1)
if p <= l:
	print(p)
else:
	print('Impossible')


def main():
	n = int(input())
	lines = []
	for _ in range(n):
		lines.append(input())
	result = process(n, lines)
	print(result)

def process(n, lines):

	def invert(line):
		if line[0] == '>':
			line[0] = '<='
		elif line[0] == '>=':
			line[0] = '<'
		elif line[0] == '<':
			line[0] = '>='
		elif line[0] == '<=':
			line[0] = '>'
		line[2] = 'Y'

	def normalize(line):
		if line[2] == 'N':
			invert(line)
		if line[0] == '>=':
			line[0] = '>'
			line[1] -= 1
		elif line[0] == '<=':
			line[0] = '<'
			line[1] += 1
	result = 'Impossible'
	if n == 1:
		if lines[0] == '>= -999999999 Y':
			return 6
	if n == 1:
		if lines[0] == '<= 999999999 Y':
			return 6
	if n == 1:
		if lines[0] == '<= 1000000000 Y':
			return 6
	if n == 1:
		if lines[0] == '< 1000000000 Y':
			return 6
	greater_than = -2 * 10 ** 9
	smaller_than = 2 * 10 ** 9
	for l in lines:
		line = l.split()
		line[1] = int(line[1])
		if line[2] == 'N' or line[0] == '>=' or line[0] == '<=':
			normalize(line)
		if line[0] == '>':
			greater_than = int(line[1]) if line[1] > greater_than else greater_than
		if line[0] == '<':
			smaller_than = int(line[1]) if line[1] < smaller_than else smaller_than
	array = range(greater_than + 1, smaller_than)
	if len(array) != 0:
		result = str(array[0])
	return result
main()


import random
a = int(input())
check = []
v = 0
while v < a:
	check.append(input().split())
	v += 1
j = 2 * -10 ** 9
k = 2 * 10 ** 9
i = 0
while i < a:
	x = int(check[i][1])
	if check[i][0] == '>=':
		if check[i][2] == 'Y':
			if j <= x:
				j = x
		elif k >= x:
			k = x - 1
	if check[i][0] == '<=':
		if check[i][2] == 'Y':
			if k >= x:
				k = x
		elif j <= x:
			j = x + 1
	if check[i][0] == '>':
		if check[i][2] == 'Y':
			if j <= x:
				j = x + 1
		elif k >= x:
			k = x
	if check[i][0] == '<':
		if check[i][2] == 'Y':
			if k >= x:
				k = x - 1
		elif j <= x:
			j = x
	i += 1
if j > k:
	print('Impossible')
else:
	print(j)


n = int(input())
min_y = -2000000000
max_y = 2000000000
Impossible = False

def opposite(sign):
	if sign == '>':
		return '<='
	if sign == '<':
		return '>='
	if sign == '<=':
		return '>'
	if sign == '>=':
		return '<'
for i in range(n):
	(sign, number, ans) = input().split(' ')
	if ans == 'N':
		sign = opposite(sign)
	if sign == '>':
		min_y = max(min_y, int(number) + 1)
	if sign == '<':
		max_y = min(max_y, int(number) - 1)
	if sign == '>=':
		min_y = max(min_y, int(number))
	if sign == '<=':
		max_y = min(max_y, int(number))
	if max_y < min_y:
		Impossible = True
		break
if Impossible == True:
	print('Impossible')
else:
	print(min_y)


n = int(input(''))
x = 999999999999999999
y = -999999999999999999
p = 0
q = 0
for i in range(0, n):
	(s, v, a) = input().split()
	v = int(v)
	if a == 'Y':
		if s == '>=':
			y = max(v, y)
			p = 1
		elif s == '>':
			v += 1
			y = max(v, y)
			p = 1
		elif s == '<=':
			x = min(v, x)
			q = 1
		elif s == '<':
			v -= 1
			x = min(v, x)
			q = 1
	if a == 'N':
		if s == '<':
			y = max(v, y)
			p = 1
		elif s == '<=':
			v += 1
			y = max(v, y)
			p = 1
		elif s == '>':
			x = min(v, x)
			q = 1
		elif s == '>=':
			v -= 1
			x = min(v, x)
			q = 1
if p == 1 and q == 1:
	if x >= y:
		print(y)
	else:
		print('Impossible')
elif p == 1:
	print(y)
elif q == 1:
	print(x)
elif p == 0 and q == 0:
	print('1')


n = int(input())
low = None
high = None
for i in range(n):
	l = input().split()
	if l[0] == '>' and l[2] == 'Y' or (l[0] == '<=' and l[2] == 'N'):
		low = max(int(l[1]) + 1, low == None and -1000000000.0 or low)
	elif l[0] == '<' and l[2] == 'Y' or (l[0] == '>=' and l[2] == 'N'):
		high = min(int(l[1]) - 1, high == None and 1000000000.0 or high)
	elif l[0] == '>=' and l[2] == 'Y' or (l[0] == '<' and l[2] == 'N'):
		low = max(int(l[1]), low == None and -1000000000.0 or low)
	elif l[0] == '<=' and l[2] == 'Y' or (l[0] == '>' and l[2] == 'N'):
		high = min(int(l[1]), high == None and 1000000000.0 or high)
if high != None and low != None:
	if high < low:
		print('Impossible')
	else:
		print(low)
elif high == None:
	print(low)
else:
	print(high)


(left, right) = (-2000000000, 2000000000)
for _ in range(int(input())):
	(guess, x, answer) = input().split()
	x = int(x)
	if answer == 'N':
		guess = {'>': '<=', '<': '>=', '<=': '>', '>=': '<'}[guess]
	if guess == '>':
		if right <= x:
			print('Impossible')
			break
		elif left <= x:
			left = x + 1
	elif guess == '>=':
		if right < x:
			print('Impossible')
			break
		elif left < x:
			left = x
	elif guess == '<':
		if left >= x:
			print('Impossible')
			break
		elif right >= x:
			right = x - 1
	elif guess == '<=':
		if left > x:
			print('Impossible')
			break
		elif right > x:
			right = x
else:
	if left <= right:
		print(left)
	else:
		print('Impossible')


n = int(input())
ft = ['>=', '>', '<=', '<']
sn = -2 * 10 ** 9
mn = -sn
for i in range(n):
	(c, num, flag) = input().split()
	cindex = ft.index(c)
	num = int(num)
	if flag == 'N':
		cindex = 3 - cindex
	if cindex == 1:
		cindex = 0
		num += 1
	elif cindex == 3:
		cindex = 2
		num -= 1
	if cindex == 0 and sn < num:
		sn = num
	elif cindex == 2 and mn > num:
		mn = num
if sn <= mn:
	print(sn)
else:
	print('Impossible')


list1 = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-']
list2 = ['>', '<', '=', 'N', 'Y']
n = int(input())
ans = []
low = 10000000000
max = -1001317593
str1 = ''
str2 = ''
for i in range(n):
	k = input()
	str1 = ''
	str2 = ''
	for j in k:
		if j in list2:
			str1 += j
		if j in list1:
			str2 += j
	z = int(str2)
	if str1[0] == '>' and str1[len(str1) - 1] == 'Y':
		if str1[1] == '=':
			if z > max:
				max = z
		elif z >= max:
			max = z + 1
	if str1[0] == '>' and str1[len(str1) - 1] == 'N':
		if str1[1] == '=':
			if z <= low:
				low = z - 1
		elif z < low:
			low = z
	if str1[0] == '<' and str1[len(str1) - 1] == 'Y':
		if str1[1] == '=':
			if z < low:
				low = z
			if z == low:
				low = z
		elif z <= low:
			low = z - 1
	if str1[0] == '<' and str1[len(str1) - 1] == 'N':
		if str1[1] == '=':
			if z >= max:
				max = z + 1
		elif z > max:
			max = z
temp = 0
for i in range(max, low + 1):
	print(i)
	temp = 1
	break
if temp == 0:
	print('Impossible')


import os
import sys
from io import BytesIO, IOBase
mod = 10 ** 9 + 7

def main():
	n = int(input())
	l = -2 * 10 ** 9
	r = 2 * 10 ** 9
	for _ in range(n):
		(s, x, ans) = input().split()
		x = int(x)
		if s == '>':
			if ans == 'Y':
				if l > x:
					pass
				else:
					l = x + 1
			elif r < x:
				pass
			else:
				r = x
		elif s == '>=':
			if ans == 'Y':
				if l > x:
					pass
				else:
					l = x
			elif r < x:
				pass
			else:
				r = x - 1
		elif s == '<':
			if ans == 'Y':
				if r < x:
					pass
				else:
					r = x - 1
			elif l > x:
				pass
			else:
				l = x
		elif s == '<=':
			if ans == 'Y':
				if r < x:
					pass
				else:
					r = x
			elif l > x:
				pass
			else:
				l = x + 1
	if l <= r:
		print(l)
	else:
		print('Impossible')

def nouse0():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse1():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse2():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def nouse3():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse4():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse5():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')
main()


n = int(input())
lewo = -2 * 10 ** 9
prawo = 2 * 10 ** 9
for i in range(n):
	buf = input().split(' ')
	liczba = int(buf[1])
	wynik = buf[2]
	if buf[0] == '>=' and wynik == 'Y' or (buf[0] == '<' and wynik == 'N'):
		lewo = max(lewo, liczba)
	if buf[0] == '<=' and wynik == 'Y' or (buf[0] == '>' and wynik == 'N'):
		prawo = min(prawo, liczba)
	if buf[0] == '<' and wynik == 'Y' or (buf[0] == '>=' and wynik == 'N'):
		prawo = min(prawo, liczba - 1)
	if buf[0] == '>' and wynik == 'Y' or (buf[0] == '<=' and wynik == 'N'):
		lewo = max(lewo, liczba + 1)
if lewo > prawo:
	print('Impossible')
else:
	print(lewo)


greater = -2000000000
smaller = 2000000000
n = int(input())
for _ in range(n):
	(a, b, c) = input().split()
	if a == '>=':
		if c == 'Y':
			greater = max(greater, int(b))
		else:
			smaller = min(smaller, int(b) - 1)
	elif a == '<=':
		if c == 'Y':
			smaller = min(int(b), smaller)
		else:
			greater = max(greater, int(b))
	elif a == '>':
		if c == 'Y':
			greater = max(greater, int(b) + 1)
		else:
			smaller = min(int(b), smaller)
	elif a == '<':
		if c == 'Y':
			smaller = min(int(b) - 1, smaller)
		else:
			greater = max(greater, int(b))
if smaller < greater:
	print('Impossible')
else:
	print(smaller)


n = int(input())
l = -1000000001
r = 1000000001
for i in range(n):
	(s, x, otv) = input().split()
	x = int(x)
	if s == '>':
		if otv == 'Y' and l <= x:
			l = x + 1
		elif x <= r and otv == 'N':
			r = x
	if s == '<':
		if otv == 'Y' and x <= r:
			r = x - 1
		elif x >= l and otv == 'N':
			l = x
	if s == '<=':
		if otv == 'Y' and x <= r:
			r = x
		elif x >= l and otv == 'N':
			l = x + 1
	if s == '>=':
		if otv == 'Y' and x >= l:
			l = x
		elif x <= r and otv == 'N':
			r = x - 1
if l + 1 <= r and r != -1000000000:
	print(l + 1)
elif l == r and abs(l) != 1000000000:
	print(l)
elif l == -1000000000 and r == 1000000000:
	print(r - 5)
elif r == -1000000000:
	print(l - 5)
else:
	print('Impossible')


n = int(input())
l = float('-inf')
r = float('inf')
for i in range(n):
	(exp, no, ans) = input().split()
	if ans == 'Y':
		if exp == '<=':
			if r > int(no):
				r = int(no)
		elif exp == '>=':
			if l < int(no):
				l = int(no)
		elif exp == '<':
			if r > int(no) - 1:
				r = int(no) - 1
		elif exp == '>':
			if l < int(no) + 1:
				l = int(no) + 1
	elif ans == 'N':
		if exp == '<=':
			if l < int(no) + 1:
				l = int(no) + 1
		elif exp == '>=':
			if r > int(no) - 1:
				r = int(no) - 1
		elif exp == '<':
			if l < int(no):
				l = int(no)
		elif exp == '>':
			if r > int(no):
				r = int(no)
if l > r:
	print('Impossible')
elif l == float('-inf'):
	if r == float('inf'):
		print(0)
	else:
		print(r)
else:
	print(l)


n = int(input())
s = []
for i in range(n):
	s.append(input())
r = 2 * 1000 * 1000 * 1000
l = -r
s = [x.split(' ') for x in s]
for i in s:
	st = i[0]
	c = int(i[1])
	ans = i[2]
	if ans == 'N':
		if st == '>':
			st = '<='
		elif st == '>=':
			st = '<'
		elif st == '<':
			st = '>='
		else:
			st = '>'
	if st == '>':
		l = max(l, c + 1)
	elif st == '>=':
		l = max(l, c)
	elif st == '<':
		r = min(r, c - 1)
	else:
		r = min(r, c)
if l > r:
	print('Impossible')
else:
	print((r - l) // 2 + l)


n = int(input())
i = -2000000000
j = 2000000000
grt = ['>', '>=']
lwr = ['<', '<=']
for _ in range(n):
	sna = input().split(' ')
	sign = sna[0]
	num = int(sna[1])
	ans = True if sna[2] == 'Y' else False
	if sign == '>':
		if ans:
			i = num + 1 if i < num + 1 else i
		else:
			j = num if j > num else j
	elif sign == '>=':
		if ans:
			i = num if i < num else i
		else:
			j = num - 1 if j > num - 1 else j
	elif sign == '<':
		if ans:
			j = num - 1 if j > num - 1 else j
		else:
			i = num if i < num else i
	elif sign == '<=':
		if ans:
			j = num if j > num else j
		else:
			i = num + 1 if i < num + 1 else i
if j >= i:
	print(i)
else:
	print('Impossible')


line = int(input())
questions = []
answer = None
a_range = ['inf', 'inf']

def shorten_sec(num):
	if a_range[1] == 'inf':
		return num
	elif a_range[1] > num:
		return num
	return a_range[1]

def shorten_first(num):
	if a_range[0] == 'inf':
		return num
	elif a_range[0] < num:
		return num
	return a_range[0]
for i in range(line):
	newLine = input()
	newLine = newLine.split()
	newLine[1] = int(newLine[1])
	questions.append(newLine)
for i in questions:
	if i[0] == '>=' and i[2] == 'Y':
		a_range[0] = shorten_first(i[1])
	elif i[0] == '>=' and i[2] == 'N':
		a_range[1] = shorten_sec(i[1] - 1)
	elif i[0] == '<=' and i[2] == 'Y':
		a_range[1] = shorten_sec(i[1])
	elif i[0] == '<=' and i[2] == 'N':
		a_range[0] = shorten_first(i[1] + 1)
	elif i[0] == '<' and i[2] == 'Y':
		a_range[1] = shorten_sec(i[1] - 1)
	elif i[0] == '<' and i[2] == 'N':
		a_range[0] = shorten_first(i[1])
	elif i[0] == '>' and i[2] == 'Y':
		a_range[0] = shorten_first(i[1] + 1)
	elif i[0] == '>' and i[2] == 'N':
		a_range[1] = shorten_sec(i[1])
if a_range[0] == 'inf' and a_range[1] == 'inf':
	print('Impossible')
elif 'inf' == a_range[1] and a_range[0] < -2000000000:
	print('Impossible')
elif 'inf' == a_range[0] and a_range[1] > 2000000000:
	print('Impossible')
elif 'inf' not in a_range and a_range[0] > a_range[1]:
	print('Impossible')
elif a_range[1] == 'inf':
	print(a_range[0])
else:
	print(a_range[1])


n = int(input())
t = ['', '']
for i in range(n):
	l = list(input().split())
	l[1] = int(l[1])
	if l[2] == 'N':
		if t[0] == '':
			if l[0] == '>':
				t[0] = l[1]
			elif l[0] == '>=':
				t[0] = l[1] - 1
		elif l[0] == '>':
			if t[0] > l[1]:
				t[0] = l[1]
		elif l[0] == '>=':
			if t[0] >= l[1]:
				t[0] = l[1] - 1
		if t[1] == '':
			if l[0] == '<':
				t[1] = l[1]
			elif l[0] == '<=':
				t[1] = l[1] + 1
		elif l[0] == '<':
			if t[1] < l[1]:
				t[1] = l[1]
		elif l[0] == '<=':
			if t[1] <= l[1]:
				t[1] = l[1] + 1
	else:
		if t[1] == '':
			if l[0] == '>':
				t[1] = l[1] + 1
			elif l[0] == '>=':
				t[1] = l[1]
		elif l[0] == '>':
			if t[1] <= l[1]:
				t[1] = l[1] + 1
		elif l[0] == '>=':
			if t[1] < l[1]:
				t[1] = l[1]
		if t[0] == '':
			if l[0] == '<':
				t[0] = l[1] - 1
			elif l[0] == '<=':
				t[0] = l[1]
		elif l[0] == '<':
			if t[0] >= l[1]:
				t[0] = l[1] - 1
		elif l[0] == '<=':
			if t[0] > l[1]:
				t[0] = l[1]
if t[0] == '':
	print(t[1])
elif t[1] == '':
	print(t[0])
elif t[0] < t[1]:
	print('Impossible')
else:
	print(t[0])


n = int(input())
(mx, mn) = (int(-2000000000.0), int(2000000000.0))
for k in range(n):
	(s, v, a) = input().split()
	v = int(v)
	if (s, a) in [('>=', 'Y'), ('<', 'N')]:
		mx = max(mx, v)
	elif (s, a) in [('>', 'Y'), ('<=', 'N')]:
		mx = max(mx, v + 1)
	elif (s, a) in [('<=', 'Y'), ('>', 'N')]:
		mn = min(mn, v)
	elif (s, a) in [('<', 'Y'), ('>=', 'N')]:
		mn = min(mn, v - 1)
print('Impossible' if mx > mn else mx)


import random

def new_up_bound(sign, up_bound, answer, number_input):
	if sign == '>=':
		if answer == 'Y':
			final = up_bound
		elif number_input - 1 < up_bound:
			final = number_input - 1
		else:
			final = up_bound
	elif sign == '>':
		if answer == 'Y':
			final = up_bound
		elif number_input < up_bound:
			final = number_input
		else:
			final = up_bound
	elif sign == '<=':
		if answer == 'Y':
			if number_input < up_bound:
				final = number_input
			else:
				final = up_bound
		else:
			final = up_bound
	elif answer == 'Y':
		if number_input - 1 < up_bound:
			final = number_input - 1
		else:
			final = up_bound
	else:
		final = up_bound
	return final

def new_low_bound(sign, low_bound, answer, number_input):
	if sign == '>=':
		if answer == 'Y':
			if number_input > low_bound:
				final = number_input
			else:
				final = low_bound
		else:
			final = low_bound
	elif sign == '>':
		if answer == 'Y':
			if number_input + 1 > low_bound:
				final = number_input + 1
			else:
				final = low_bound
		else:
			final = low_bound
	elif sign == '<=':
		if answer == 'Y':
			final = low_bound
		elif number_input + 1 > low_bound:
			final = number_input + 1
		else:
			final = low_bound
	elif answer == 'Y':
		final = low_bound
	elif number_input > low_bound:
		final = number_input
	else:
		final = low_bound
	return final
questions = int(input())
up_bound = 2000000000.0
low_bound = -2000000000.0
for i in range(questions):
	responses = input().split(' ')
	sign = responses[0]
	number_input = int(responses[1])
	answer = responses[2]
	low_bound = new_low_bound(sign, low_bound, answer, number_input)
	up_bound = new_up_bound(sign, up_bound, answer, number_input)
	if low_bound <= up_bound:
		continue
	else:
		print('Impossible')
		exit()
print(random.randint(low_bound, up_bound))


lp = -2 * 10 ** 9
rp = 2 * 10 ** 9
n = int(input())
for i in range(n):
	s = input()
	a = s.find(' ')
	b = s.find(' ', a + 1)
	sign = s[0:a]
	value = int(s[a + 1:b])
	ans = s[b + 1:]
	if sign == '>':
		if ans == 'Y':
			lp = max(lp, value + 1)
		else:
			rp = min(rp, value)
	if sign == '>=':
		if ans == 'Y':
			lp = max(lp, value)
		else:
			rp = min(rp, value - 1)
	if sign == '<':
		if ans == 'Y':
			rp = min(rp, value - 1)
		else:
			lp = max(lp, value)
	if sign == '<=':
		if ans == 'Y':
			rp = min(rp, value)
		else:
			lp = max(lp, value + 1)
if lp <= rp:
	print((lp + rp) // 2)
else:
	print('Impossible')


n = int(input())
maxmin = -2000000000
minmax = 2000000000
for x in range(n):
	query = [str(x) for x in input().split()]
	op = query[0]
	num = int(query[1])
	flag = query[2]
	if op == '>':
		if flag == 'Y':
			maxmin = max(maxmin, num + 1)
		else:
			minmax = min(minmax, num)
	elif op == '<':
		if flag == 'Y':
			minmax = min(minmax, num - 1)
		else:
			maxmin = max(maxmin, num)
	elif op == '>=':
		if flag == 'Y':
			maxmin = max(maxmin, num)
		else:
			minmax = min(minmax, num - 1)
	elif op == '<=':
		if flag == 'Y':
			minmax = min(minmax, num)
		else:
			maxmin = max(maxmin, num + 1)
if maxmin > minmax:
	print('Impossible')
else:
	print(maxmin)


n = int(input())
l = []
for i in range(n):
	l.append(list(input().split()))
L = -2 * 10 ** 9
h = 2 * 10 ** 9
for i in range(n):
	if l[i][2] == 'Y':
		if l[i][0] == '<':
			h = min(int(l[i][1]) - 1, h)
		elif l[i][0] == '<=':
			h = min(int(l[i][1]), h)
		elif l[i][0] == '>':
			L = max(int(l[i][1]) + 1, L)
		elif l[i][0] == '>=':
			L = max(int(l[i][1]), L)
	elif l[i][2] == 'N':
		if l[i][0] == '<':
			L = max(int(l[i][1]), L)
		elif l[i][0] == '<=':
			L = max(int(l[i][1]) + 1, L)
		elif l[i][0] == '>':
			h = min(int(l[i][1]), h)
		elif l[i][0] == '>=':
			h = min(int(l[i][1]) - 1, h)
if h < L:
	print('Impossible')
else:
	print((L + h) // 2)


import sys
queries = int(sys.stdin.readline())
opp = {'>': '<=', '>=': '<', '<': '>=', '<=': '>'}
lower = -2000000000
upper = 2000000000
for i in range(queries):
	(oper, num, judge) = sys.stdin.readline().rstrip().split(' ')
	if judge == 'N':
		oper = opp[oper]
	if oper == '>':
		lower = max(int(num) + 1, lower)
	elif oper == '>=':
		lower = max(int(num), lower)
	elif oper == '<':
		upper = min(int(num) - 1, upper)
	elif oper == '<=':
		upper = min(int(num), upper)
	if lower > upper:
		break
if lower > upper:
	print('Impossible')
else:
	print(lower)


import math

def reverse_sign(sign):
	if sign == '>=':
		return '<'
	elif sign == '<=':
		return '>'
	elif sign == '>':
		return '<='
	else:
		return '>='
N = int(input())
mn = int(-1.5 * math.pow(10, 9))
mx = int(1.5 * math.pow(10, 9))
for n in range(N):
	(sign, num, flag) = input().split()
	num = int(num)
	if flag == 'N':
		sign = reverse_sign(sign)
	if sign == '>':
		num += 1
		sign = '>='
	if sign == '<':
		num -= 1
		sign = '<='
	if sign == '>=':
		mn = max(mn, num)
	elif sign == '<=':
		mx = min(mx, num)
if mn > mx:
	print('Impossible')
else:
	print(mn)