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.util.*;
import java.io.*;
public class AA416
{
	public static void process()throws IOException
	{
	  
	   ArrayList<Long> gt=new ArrayList<Long>();
	   ArrayList<Long> lt=new ArrayList<Long>();
		int n=I();
		for(int i=0;i<n;i++)
		{
			String s=S();
			long a=L();
			char b=C();
			if(s.equals(">="))
			{
				
				if(b=='Y')
				{
					gt.add(a);
				}
				else
				{
					lt.add(a-1);
				}
			}
			
			else
				if(s.equals(">"))
				{
					if(b=='Y')
					{
						gt.add(a+1);
					}
					else
					{
						lt.add(a);
					}
				}
			else
				if(s.equals("<"))
				{
					if(b=='Y')
					{
						lt.add(a-1);
					}
					else
					{
						gt.add(a);
					}
				}
				else
				if(s.equals("<="))
				{
					if(b=='Y')
					{
						lt.add(a);
					}
					else
					{
						gt.add(a+1);
					}
				}
		}
		Collections.sort(gt);
		Collections.sort(lt);
    
		
      boolean flag=false;
      if(gt.size()==0)
      {
      	pn(lt.get(0));
      }
      else
      	 if(lt.size()==0)
      	    {
      	    	pn(gt.get(gt.size()-1));
      	    }
        else
      if(gt.get(gt.size()-1)<=lt.get(0))
      {
    	  pn((long)(Math.random() *(lt.get(0) - gt.get(gt.size()-1) + 1)) + gt.get(gt.size()-1));
      }
      else
    
      {
    	  pn("Impossible");
      }
	}
	static Scanner sc = new Scanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);
	static void pn(Object o){out.println(o);out.flush();}
	static void p(Object o){out.print(o);out.flush();}
	static void pni(Object o){out.println(o);System.out.flush();}
	static int I() throws IOException{return sc.nextInt();}
	static long L() throws IOException{return sc.nextLong();}
	static double D() throws IOException{return sc.nextDouble();}
	static String S() throws IOException{return sc.next();}
	static char C() throws IOException{return sc.next().charAt(0);}
	static int[] Ai(int n) throws IOException{int[] arr = new int[n];for (int i = 0; i < n; i++)arr[i] = I();return arr;}
	static String[] As(int n) throws IOException{String s[] = new String[n];for (int i = 0; i < n; i++)s[i] = S();return s;}
	static long[] Al(int n) throws IOException {long[] arr = new long[n];for (int i = 0; i < n; i++)arr[i] = L();return arr;}
//	*--------------------------------------------------------------------------------------------------------------------------------*//
	static class AnotherReader {BufferedReader br;StringTokenizer st;AnotherReader() throws FileNotFoundException {br = new BufferedReader(new InputStreamReader(System.in));}
	AnotherReader(int a) throws FileNotFoundException {br = new BufferedReader(new FileReader("input.txt"));}
	String next() throws IOException{while (st == null || !st.hasMoreElements()) {try {st = new StringTokenizer(br.readLine());} catch (IOException e) {e.printStackTrace();}}return st.nextToken();}
	int nextInt() throws IOException {return Integer.parseInt(next());}
	long nextLong() throws IOException {return Long.parseLong(next());}
	double nextDouble() throws IOException {return Double.parseDouble(next());}
	String nextLine() throws IOException {String str = "";try {str = br.readLine();} catch (IOException e) {e.printStackTrace();}return str;}}
	public static void main(String[] args)throws IOException{try{boolean oj=true;if(oj==true)
	{AnotherReader sk=new AnotherReader();PrintWriter out=new PrintWriter(System.out);}
	else
	{AnotherReader sk=new AnotherReader(100);out=new PrintWriter("output.txt");}
	
	{process();}out.flush();out.close();}catch(Exception e){return;}}}
//*-----------------------------------------------------------------------------------------------------------------------------------*//