#include <bits/stdc++.h>
using namespace std;
struct Bitset {
  const static int K = 64, X = 63;
  static inline unsigned long long getsetmask(int l, int r) {
    if (r == X) return -(1ULL << l);
    return (1ULL << (r + 1)) - (1ULL << l);
  }
  vector<unsigned long long> bs;
  int N;
  Bitset(int n) {
    N = n / K + 1;
    bs.resize(N);
  }
  void assign(unsigned long long x) {
    fill(bs.begin() + 1, bs.end(), 0);
    bs[0] = x;
  }
  bool get(int i) { return bs[i >> 6] & (1ULL << (i & X)); }
  void set(int i) { bs[i >> 6] |= (1ULL << (i & X)); }
  void reset(int i) { bs[i >> 6] &= ~(1ULL << (i & X)); }
  void flip(int i) { bs[i >> 6] ^= (1ULL << (i & X)); }
  void set(int l, int r) {
    int idl = l >> 6;
    int idr = r >> 6;
    int posl = l & X;
    int posr = r & X;
    if (idl == idr) {
      bs[idl] |= getsetmask(posl, posr);
      return;
    }
    bs[idl] |= getsetmask(posl, 63);
    bs[idr] |= getsetmask(0, posr);
    for (int id = idl + 1; id < idr; id++) bs[id] = -1;
  }
  void reset(int l, int r) {
    int idl = l >> 6;
    int idr = r >> 6;
    int posl = l & X;
    int posr = r & X;
    if (idl == idr) {
      bs[idl] &= ~getsetmask(posl, posr);
      return;
    }
    bs[idl] &= ~getsetmask(posl, 63);
    bs[idr] &= ~getsetmask(0, posr);
    for (int id = idl + 1; id < idr; id++) bs[id] = 0;
  }
  void flip(int l, int r) {
    int idl = l >> 6;
    int idr = r >> 6;
    int posl = l & X;
    int posr = r & X;
    if (idl == idr) {
      bs[idl] ^= getsetmask(posl, posr);
      return;
    }
    bs[idl] ^= getsetmask(posl, 63);
    bs[idr] ^= getsetmask(0, posr);
    for (int id = idl + 1; id < idr; id++) bs[id] = ~bs[id];
  }
};
const int N = 1e5 + 7;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, q;
  cin >> n >> q;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  Bitset bs(2 * N + 1);
  bs.set(0 + N, N + N);
  while (q--) {
    char c;
    int x;
    cin >> c >> x;
    if (c == '<') {
      if (x <= 0)
        bs.set(-N + N, x - 1 + N), bs.set(-x + 1 + N, N + N);
      else
        bs.set(-N + N, -x + N), bs.flip(-x + 1 + N, x - 1 + N),
            bs.set(x + N, N + N);
    } else {
      if (x >= 0)
        bs.reset(-N + N, -x - 1 + N), bs.reset(x + 1 + N, N + N);
      else
        bs.reset(-N + N, x + N), bs.flip(x + 1 + N, -x - 1 + N),
            bs.reset(-x + N, N + N);
    }
  }
  for (int i = 0; i < n; i++) {
    bool b = bs.get(a[i] + N);
    if (b)
      a[i] = abs(a[i]);
    else
      a[i] = -abs(a[i]);
    cout << a[i] << " ";
  }
}
