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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
template <class T>
void out(const vector<T> &a) {
  cout << "array: ";
  for (int i = 0; i < (int)a.size(); i++) cout << a[i] << " ";
  cout << endl;
  cout.flush();
}
void binprint(int mask, int n) {
  int i;
  string s = "";
  do {
    s += (mask % 2 + '0');
    mask /= 2;
  } while (mask);
  reverse(s.begin(), s.end());
  s = string(max(n - (int)s.size(), 0), '0') + s;
  for (i = (int)s.size() - n; i < (int)s.size(); i++) printf("%c", s[i]);
  printf("\n");
}
void ASCII_Chart() {
  int i, j, k;
  printf("ASCII Chart:(30-129)\n");
  for (i = 30; i <= 50; i++) {
    for (j = 0; j < 5; j++) {
      k = i + j * 20;
      printf("%3d---> '%c'   ", k, k);
    }
    printf("\n");
  }
}
template <class T>
inline T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
template <class T>
inline T lcm(T a, T b) {
  if (a < 0) return lcm(-a, b);
  if (b < 0) return lcm(a, -b);
  return a * (b / gcd(a, b));
}
template <class T>
T Abs(T x) {
  return x > 0 ? x : -x;
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
template <class T>
inline T Mod(T n, T m) {
  return (n % m + m) % m;
}
int BigMod(long long B, long long P, long long M) {
  long long R = 1;
  while (P > 0) {
    if (P % 2 == 1) {
      R = (R * B) % M;
    }
    P /= 2;
    B = (B * B) % M;
  }
  return (int)R;
}
long long mulmod(long long a, long long b, long long c) {
  long long x = 0, y = a % c;
  while (b > 0) {
    if (b % 2 == 1) {
      x = (x + y) % c;
    }
    y = (y * 2) % c;
    b /= 2;
  }
  return x % c;
}
long long mpow(long long x, long long k) {
  if (k == 0) return 1;
  long long r = mpow(x, k / 2);
  return k % 2 ? (r * r * x) : (r * r);
}
vector<string> SubstringGenerate(string str) {
  int i, j, len;
  vector<string> store;
  len = (int)str.size();
  for (i = 0; i < len; i++)
    for (j = i; j <= len; j++) store.push_back(str.substr(i, j - i + 1));
  return store;
}
template <class T>
inline bool isPrime(T n) {
  if (n <= 1) return false;
  for (T i = 2; i * i <= n; i++)
    if (n % i == 0) return false;
  return true;
}
bool IsVowel(char ch) {
  ch = tolower(ch);
  if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u')
    return true;
  return false;
}
bool isUpperCase(char c) { return c >= 'A' && c <= 'Z'; }
bool isLowerCase(char c) { return c >= 'a' && c <= 'z'; }
bool isLetter(char c) { return c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z'; }
bool isDigit(char c) { return c >= '0' && c <= '9'; }
double deg2rad(double x) { return (PI * x) / 180.0; }
double rad2deg(double x) { return (180.0 * x) / PI; }
template <class T>
string toString(T n) {
  ostringstream oss;
  oss << n;
  oss.flush();
  return oss.str();
}
int toInt(string s) {
  int r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
long long toLl(string s) {
  long long r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
double toDouble(string s) {
  double r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
template <typename T>
static void splitstr(const string &s, vector<T> &out) {
  istringstream in(s);
  out.clear();
  copy(istream_iterator<T>(in), istream_iterator<T>(), back_inserter(out));
}
struct debugger {
  template <typename T>
  debugger &operator,(const T &v) {
    cerr << v << "\t";
    return *this;
  }
} dbg;
struct Point {
  int x, y;
  Point(int _x = 0, int _y = 0) {
    x = _x;
    y = _y;
  }
};
bool com(int a, int b) { return a < b; }
int main() {
  long long i, q, n;
  char ch;
  string str;
  while (cin >> q) {
    long long upper = ((1 << 31) - 1), down = (-(1 << 31));
    vector<long long> v1, v2;
    for (i = 0; i < q; i++) {
      cin >> str >> n >> ch;
      if (str == ">")
        if (ch == 'N')
          v1.push_back(n + 1);
        else
          v2.push_back(n);
      else if (str == ">=")
        if (ch == 'N')
          v1.push_back(n);
        else
          v2.push_back(n - 1);
      else if (str == "<")
        if (ch == 'N')
          v2.push_back(n - 1);
        else
          v1.push_back(n);
      else if (str == "<=")
        if (ch == 'N')
          v2.push_back(n);
        else
          v1.push_back(n + 1);
    }
    for (i = 0; i < (int)v1.size(); i++) upper = min(upper, v1[i]);
    for (i = 0; i < (int)v2.size(); i++) down = max(down, v2[i]);
    if (upper == ((1 << 31) - 1) && down == (-(1 << 31)))
      cout << "1" << endl;
    else if (upper == ((1 << 31) - 1))
      cout << down + 1 << endl;
    else if (down == (-(1 << 31)))
      cout << upper - 1 << endl;
    else {
      if ((down + 1) > (upper - 1))
        cout << "Impossible" << endl;
      else
        cout << down + 1 << endl;
    }
  }
  return 0;
}