#include <bits/stdc++.h>
using namespace std;
template <typename TH>
void _dbg(const char* sdbg, TH h) {
  cerr << sdbg << "=" << h << "\n";
}
template <typename TH, typename... TA>
void _dbg(const char* sdbg, TH h, TA... t) {
  while (*sdbg != ',') {
    cerr << *sdbg++;
  }
  cerr << "=" << h << ",";
  _dbg(sdbg + 1, t...);
}
template <class C>
void mini(C& a4, C b4) {
  a4 = min(a4, b4);
}
template <class C>
void maxi(C& a4, C b4) {
  a4 = max(a4, b4);
}
template <class T1, class T2>
ostream& operator<<(ostream& out, pair<T1, T2> pair) {
  return out << "(" << pair.first << ", " << pair.second << ")";
}
template <class A, class B, class C>
struct Triple {
  A first;
  B second;
  C third;
  bool operator<(const Triple& t) const {
    if (first != t.first) return first < t.first;
    if (second != t.second) return second < t.second;
    return third < t.third;
  }
};
template <class T>
void ResizeVec(T&, vector<long long>) {}
template <class T>
void ResizeVec(vector<T>& vec, vector<long long> sz) {
  vec.resize(sz[0]);
  sz.erase(sz.begin());
  if (sz.empty()) {
    return;
  }
  for (T& v : vec) {
    ResizeVec(v, sz);
  }
}
template <class A, class B, class C>
ostream& operator<<(ostream& out, Triple<A, B, C> t) {
  return out << "(" << t.first << ", " << t.second << ", " << t.third << ")";
}
template <class T>
ostream& operator<<(ostream& out, vector<T> vec) {
  out << "(";
  for (auto& v : vec) out << v << ", ";
  return out << ")";
}
template <class T>
ostream& operator<<(ostream& out, set<T> vec) {
  out << "(";
  for (auto& v : vec) out << v << ", ";
  return out << ")";
}
template <class L, class R>
ostream& operator<<(ostream& out, map<L, R> vec) {
  out << "(";
  for (auto& v : vec) out << v << ", ";
  return out << ")";
}
struct Node {
  long long flip, set_min, set_plus;
  Node() { flip = set_min = set_plus = 0; }
};
const long long M = 1 << 18;
Node drz[2 * M + 5];
void Touch(long long v) {
  if (v >= M) return;
  assert(v < M);
  for (long long son = (2 * v); son <= (2 * v + 1); ++son) {
    if (drz[v].flip) {
      if (drz[son].set_min || drz[son].set_plus) {
        swap(drz[son].set_min, drz[son].set_plus);
      } else {
        drz[son].flip ^= 1;
      }
    } else if (drz[v].set_min || drz[v].set_plus) {
      drz[son].flip = 0;
      drz[son].set_min = drz[v].set_min;
      drz[son].set_plus = drz[v].set_plus;
    }
  }
  drz[v].flip = 0;
  drz[v].set_min = 0;
  drz[v].set_plus = 0;
}
void Rec(long long bl, long long br, long long l, long long r, long long v,
         long long typ) {
  Touch(v);
  if (br < l || r < bl) {
    return;
  }
  if (l <= bl && br <= r) {
    if (typ == 0 || typ == 1) {
      drz[v].flip = 0;
      drz[v].set_min = 0;
      drz[v].set_plus = 0;
      if (typ == 0) {
        drz[v].set_min = 1;
      } else {
        drz[v].set_plus = 1;
      }
    } else {
      if (drz[v].set_min || drz[v].set_plus) {
        swap(drz[v].set_min, drz[v].set_plus);
      } else {
        drz[v].flip ^= 1;
      }
    }
    return;
  }
  long long m = (bl + br + 4 * M) / 2 - 2 * M;
  Rec(bl, m, l, r, 2 * v, typ);
  Rec(m + 1, br, l, r, 2 * v + 1, typ);
}
long long arr[M];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(10);
  if (0) cout << fixed << setprecision(10);
  cin.tie(0);
  long long n, q;
  cin >> n >> q;
  for (long long i = (1); i <= (n); ++i) {
    cin >> arr[i];
  }
  long long shift = -M / 2;
  for (long long i = (1); i <= (q); ++i) {
    char c;
    long long x;
    cin >> c >> x;
    if (c == '<') {
      x--;
    } else {
      x++;
    }
    long long ab = abs(x);
    if (x == 0) {
      if (c == '<') {
        Rec(shift, shift + M - 1, shift, shift + M - 1, 1, 1);
      } else {
        Rec(shift, shift + M - 1, shift, shift + M - 1, 1, 0);
      }
    } else if ((c == '<') == (x > 0)) {
      Rec(shift, shift + M - 1, -ab, ab, 1, 2);
      Rec(shift, shift + M - 1, shift, -ab - 1, 1, x > 0);
      Rec(shift, shift + M - 1, ab + 1, shift + M - 1, 1, x > 0);
    } else {
      Rec(shift, shift + M - 1, shift, -ab, 1, x < 0);
      Rec(shift, shift + M - 1, ab, shift + M - 1, 1, x < 0);
    }
  }
  for (long long i = (1); i <= (M - 1); ++i) {
    Touch(i);
  }
  for (long long i = (1); i <= (n); ++i) {
    long long ind = arr[i] - shift + M;
    if (drz[ind].set_min) {
      cout << -abs(arr[i]) << " ";
    } else if (drz[ind].set_plus) {
      cout << abs(arr[i]) << " ";
    } else if (drz[ind].flip) {
      cout << -arr[i] << " ";
    } else {
      cout << arr[i] << " ";
    }
  }
  cout << endl;
  return 0;
}
