Problem: 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  - 109 ≤ x ≤ 109. 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·109 ≤ y ≤ 2·109. If there are many answers, print any of them. If such value doesn't exist, print word "Impossible" (without the quotes).

Examples

Input

4
&gt;= 1 Y
&lt; 3 N
&lt;= -3 N
&gt; 55 N


Output

17


Input

2
&gt; 100 Y
&lt; -100 Y


Output

Impossible

Solution (in JAVA):

Solution:
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;


 
public class Main {

	
	class Node{
		int value, nuOfC=0, done=0;
		List<Integer> connections;
		
		public Node(){
			connections = new ArrayList<Integer>();
		}

		public int getValue() {
			return value;
		}

		public void setValue(int value) {
			this.value = value;
		}

		public int getNuOfC() {
			return nuOfC;
		}

		public void setNuOfC(int nuOfC) {
			this.nuOfC = nuOfC;
		}

		public List<Integer> getConnections() {
			return connections;
		}

		public void setConnections(List<Integer> connections) {
			this.connections = connections;
		}
		
	}
	
	
	class Net{
		HashMap <Integer, Node> map;
		
		public Net(){
			map = new HashMap <Integer, Node>(); 
		}
		
		public void addNode(int val){
			Node node= new Node();
			node.setValue(val);
			map.put(val, node);
		}

		public void editNode(int from, int to) {
			Node node = map.get(from);
			node.nuOfC++;
			node.connections.add(to);
			map.replace(from, node);
		}

		
		public int getMax() {
			int ret = 1;
			while (true){
				int max=-1111, idx = -1;
				for (int i = 0;i<=map.size();i++){
					if (map.containsKey(i) && map.get(i).nuOfC > max && map.get(i).done == 0){
						max = map.get(i).nuOfC;
						idx = i;
					}
				}
				System.out.println(idx);
				if (idx == -1)
					break;
				List<Integer> list = map.get(idx).connections;
				Node nn = map.get(idx);
				nn.done = 1;
				map.replace(idx, nn);
				for (int i = 0 ; i <  map.get(idx).nuOfC ; i++){
					ret*=2;
				}
				HashMap <Integer, Node> map1 = new HashMap <Integer, Node>();
				for (int i = 0 ; i < list.size() ; i++){
					Node nod = map.get(list.get(i));
					if (nod!=null && nod.done==0){
						nod.nuOfC--;
						map1.put(list.get(i), nod);
					}
				}
				map = map1;
			}
			return ret;
		}
	}
	

	private static int doIt(int i, int j, int res) {
		System.out.println(i + "    " + j + "    " + res);
		if (i == j)
			return res;
		if (i<=0 || j<=0)
			return -1;
		if (i %2==0){
			if (j%2==0){
				doIt(i, j/2,res+1);
				doIt(i/2, j/2,res+1);
			}
			if (j%3==0){
				doIt(i, j/3,res+1);
				doIt(i/2, j/3,res+1);
			}
			if (j%5==0){
				doIt(i, j/5,res+1);
				doIt(i/2, j/5,res+1);
			}
		}
		if (i %3==0){
			if (j%2==0){
				doIt(i, j/2,res+1);
				doIt(i/3, j/2,res+1);
			}
			if (j%3==0){
				doIt(i, j/3,res+1);
				doIt(i/3, j/3,res+1);
			}
			if (j%5==0){
				doIt(i, j/5,res+1);
				doIt(i/3, j/5,res+1);
			}
		}if (i %5==0){
			if (j%2==0){
				doIt(i, j/2,res+1);
				doIt(i/5, j/2,res+1);
			}
			if (j%3==0){
				doIt(i, j/3,res+1);
				doIt(i/5, j/3,res+1);
			}
			if (j%5==0){
				doIt(i, j/5,res+1);
				doIt(i/5, j/5,res+1);
			}
		}
		return -54;
		
			
	}

	// 200000000 150000000
	public int min = 1000000000;
	public int no = -1;
	public void doIT(int a, int b, int co){
		//System.out.println(a + "          " + b);
		if (a==b){
			min = Math.min(co,min);// System.out.println(co);
			System.out.println(co + "     " + min);
			no = 1;
		}
		if (a>b){
			if (a%2==0){
				doIT(a/2,b,co+1);
			}
			if (a%3==0){
				doIT(a/3,b,co+1);
			}
			if (a%5==0){
				doIT(a/5,b,co+1);
			}
		}else if (a<b){
			if (b%2==0){
				doIT(a,b/2,co+1);
			}
			if (b%3==0){
				doIT(a,b/3,co+1);
			}
			if (b%5==0){
				doIT(a,b/5,co+1);
			}
		}
	}
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
/*		
		//371B
		Main main = new Main();
		int a=in.nextInt(),b=in.nextInt();
		main.doIT(a, b, 0);
		if (main.no!=-1){
			System.out.println(main.min);
		}else
			System.out.println(-1);
		*/
	
		// 416A
		int n  = in.nextInt();
		int biggerThan = -2000000001,biggerThanE=-2000000002,lessThan =2000000002 , lessThanE=2000000001;
		for (int i = 0 ; i < n;i++){
			String sym = in.next(), va = in.next(), ans = in.next();
			if ((sym.equals(">") && ans.equals("Y")) || (sym.equals("<=") && ans.equals("N"))){
				biggerThan = Math.max(biggerThan, Integer.parseInt(va));
			}
			if ((sym.equals(">=") && ans.equals("Y")) || (sym.equals("<") && ans.equals("N"))){
				biggerThanE = Math.max(biggerThanE, Integer.parseInt(va));
			}
			if ((sym.equals("<") && ans.equals("Y")) || (sym.equals(">=") && ans.equals("N"))){
				lessThan = Math.min(lessThan, Integer.parseInt(va));
			}
			if ((sym.equals("<=") && ans.equals("Y")) || (sym.equals(">") && ans.equals("N"))){
				lessThanE = Math.min(lessThanE, Integer.parseInt(va));
			}
		}
	
		if (biggerThan >= biggerThanE){
			if (lessThan <= lessThanE){
				if (biggerThan+1 < lessThan ){
					System.out.println(biggerThan+1);
				}else{
					System.out.println("Impossible");
				}
			}else if (lessThan > lessThanE){
				if (biggerThan+1 <= lessThanE){
					System.out.println(biggerThan+1);
				}else{
					System.out.println("Impossible");
				}
			}
		}else if (biggerThan < biggerThanE){
			if (lessThan <= lessThanE){
				if (biggerThanE < lessThan){
					System.out.println(biggerThanE);
				}else{
					System.out.println("Impossible");
				}
			}else if (lessThan > lessThanE){
				if (biggerThanE <= lessThanE){
					System.out.println(biggerThanE);
				}else{
					System.out.println("Impossible");
				}
			}
		}
			
		
		/*
		// 5A
	 	String h;
		int l = 0;
		int alive =0;
		while((h = in.nextLine()) != null){
			if (h.charAt(0) == '+'){
				alive++;
			}
			else if (h.charAt(0) == '-'){
				alive--;
			}else{
				int idx = h.indexOf(':');
				int msg = ((int)h.length()) - idx-1;
				l += (msg*alive);
			}
		}
		System.out.println(l);
*/
		
		
/*	
		// 445B
		int n = in.nextInt(), m = in.nextInt();
		int [] arr= new int[n+1];
		int ret = (int)Math.pow(2, n-1);
		for (int i = 1 ; i <=m ;i++){
			int e = in.nextInt(), g = in.nextInt();
			arr[e] = 1;
			arr[g] = 1;
		}
		int cou = 0;
		for (int i = 1 ; i <= n ; i++){
			if (arr[i] != 1)
				cou++;
		}
		if (m!=0)
		for (int i = 0 ; i  < cou ; i ++)
			ret/=2;
		
		System.out.println(ret);
		
		
*/

		
		
		
		/*		
		//         	
	    string n; int k;
	    cin >> n >> k;
	    
	    for (int i = 0 ; i < n.size()-1 ; i++){
			if (n[i] < n[i+1] && k>0){
				char h = n[i];
				n[i] = n[i+1];
				n[i+1] = h;
				k--;
				for (int j = i ; j > 0 ; j--){
					if (n[j] > n[j-1] && k>0){
						char h = n[j];
						n[j] = n[j-1];
						n[j-1] = h;
						k--;
					}
				}
			}
			if (k==0)
				break;
		}
	    cout << n;*/
		
/*		 // 584C
		int n= in.nextInt(), m= in.nextInt();
		String s1 = in.next(), s2 = in.next();
		int same = 0;
		for (int i = 0 ; i < n ; i++){
			if (s1.charAt(i) == s2.charAt(i)){
				same++;
			}
		}
		
		if (same <= m ){
			System.out.println(-1);
			System.exit(0);
		}
*/
		
/*
		int w = in.nextInt(), h = in.nextInt(), n = in.nextInt();
		
		int arrw[] = new int[200001];
		int arrh[] = new int[200001];
		arrw[0]=1;
		arrh[0]=1;
		for (int i = 0 ; i < 4 ; i++){
			String dir = in.next();
			int num = in.nextInt();
			
			
			
			System.out.println(dir+"           "+num);
			
			
			
			if (dir.equals("H")){
				arrw[num] = 1;
			}else{
				arrh[num] = 1;
			}
			
			
			int maxw=-1231233,maxh=-1212121;
			int id = -1,idx=-1;
			for (int p = 0 ; p < 200001;p++){
				if (arrw[p]==1){
					if (id !=-1){
						maxw = Math.max(maxw, p-id);
					}
					id = p;
				}
				if (arrh[p]==1){
					if (idx !=-1){
						maxh = Math.max(maxh,p-idx);
					}
					idx = p;
				}
			}

			
			
			System.out.println(maxh * maxw);
		}
		
*/
		
		
		
		
/*
		// 614/B
		int n ;
		n = in.nextInt();
		BigInteger z = new BigInteger("10");
		String h = "";String ret = "";
		for (int j = 0 ;j < n ; j++){
			h += in.next();
			h+= " ";
		}
		

		Scanner im = new Scanner(h);
		int ind= 0;
		while(im.hasNext()){
			BigInteger g = new BigInteger(im.next());
			
			BigInteger y =z.pow(g.toString().length()-1);
			if (g.subtract(y).compareTo( BigInteger.ZERO ) == 1){
				System.out.print(g);
				String q = g.toString();
				for (int o = q.length()-1 ; o >=0 ; o--){
					if (q.charAt(o) == '0'){
						ind++;
					}
					if (q.charAt(o) != '0'){
						break;
					} 
				}
				break;
			}
		}
		im.close();

		
		int ones = 1;
		for (int i = h.length()-1 ; i>=0 ; i--){
			
			if (h.charAt(i) != '0'){
				ones=0;
			}
			if (h.charAt(i) == ' '){
				ones = 1;
			}
			if (h.charAt(i) == '0' && ones == 1 && i !=0 && h.charAt(i-1) != ' '){
				ret+='0';
			}
			if ( (h.charAt(i) == '0' && ones == 1 && i == 0) ||  (h.charAt(i) == '0' && ones == 1 && i != 0 && h.charAt(i-1) == ' ') ){
				System.out.println(0);
				in.close();
				System.exit(0);
			}

		}
System.out.println(ret.substring(0,ret.length()-ind));
*/
		
		
		
		in.close();
	}





}