#include <bits/stdc++.h>
using namespace std;
template <class A, class B>
inline bool mina(A &first, B second) {
  return (first > second) ? (first = second, 1) : 0;
}
template <class A, class B>
inline bool maxa(A &first, B second) {
  return (first < second) ? (first = second, 1) : 0;
}
class LazySegmentTree {
 public:
  typedef pair<pair<int, int>, int> Value_t;
  typedef struct tree_st {
    pair<int, int> fixed;
    int flipped;
    int l, r;
  } TreeNode;
  vector<TreeNode> tree;
  int N;
  int tree_size;
  LazySegmentTree() {}
  LazySegmentTree(int n) { build_tree(n); }
  pair<pair<int, int>, int> query(int at) { return query(1, at); }
  void update_fixed(int ll, int rr, int sign) { update_fixed(1, ll, rr, sign); }
  void update_flipped(int ll, int rr) { update_flipped(1, ll, rr); }

 private:
  void push_fixed(int at, int sign) {
    if (sign > 0) {
      tree[at].flipped = 1;
      tree[at].fixed.second = +1;
      tree[at].fixed.first = -1;
    } else {
      tree[at].flipped = 1;
      tree[at].fixed.second = -1;
      tree[at].fixed.first = +1;
    }
  }
  void push_flipped(int at) { tree[at].flipped *= -1; }
  void update_down(int at) {
    if (tree[at].fixed.first == -1) {
      push_fixed(at * 2, 1);
      push_fixed(at * 2 + 1, 1);
    } else if (tree[at].fixed.second == -1) {
      push_fixed(at * 2, -1);
      push_fixed(at * 2 + 1, -1);
    }
    if (tree[at].flipped == -1) {
      push_flipped(at * 2);
      push_flipped(at * 2 + 1);
    }
    tree[at].fixed = pair<int, int>(0, 0);
    tree[at].flipped = 1;
  }
  Value_t query(int at, int ind) {
    if (tree[at].l == tree[at].r) {
      return pair<pair<int, int>, int>(tree[at].fixed, tree[at].flipped);
    } else {
      update_down(at);
      int mid = (tree[at].l + tree[at].r) >> 1;
      pair<pair<int, int>, int> ret;
      if (ind <= mid) {
        ret = query(at * 2, ind);
      } else {
        ret = query(at * 2 + 1, ind);
      }
      return ret;
    }
  }
  void update_fixed(int at, int ll, int rr, int sign) {
    if (ll > tree[at].r || rr < tree[at].l) return;
    if (ll <= tree[at].l && tree[at].r <= rr) {
      push_fixed(at, sign);
    } else {
      update_down(at);
      update_fixed(at * 2, ll, rr, sign);
      update_fixed(at * 2 + 1, ll, rr, sign);
    }
  }
  void update_flipped(int at, int ll, int rr) {
    if (ll > tree[at].r || rr < tree[at].l) return;
    if (ll <= tree[at].l && tree[at].r <= rr) {
      push_flipped(at);
    } else {
      update_down(at);
      update_flipped(at * 2, ll, rr);
      update_flipped(at * 2 + 1, ll, rr);
    }
  }
  void build_tree(int n) {
    N = n;
    int base = 1;
    while (base < N) base *= 2;
    tree_size = base * 2;
    tree = vector<TreeNode>(tree_size);
    init(1, 1, n);
  }
  void init(int at, int ll, int rr) {
    tree[at].l = ll;
    tree[at].r = rr;
    tree[at].fixed = pair<int, int>(0, 0);
    tree[at].flipped = 1;
    if (ll < rr) {
      int mid = (tree[at].l + tree[at].r) >> 1;
      init(at * 2, tree[at].l, mid);
      init(at * 2 + 1, mid + 1, tree[at].r);
    }
  }
};
const int MAXV = 100005;
int N;
int Q;
int in[MAXV];
int main() {
  LazySegmentTree tree(MAXV);
  scanf("%d %d", &N, &Q);
  for (int i = 0; (i) < (N); ++(i)) {
    scanf("%d", &in[i]);
  }
  char c;
  int a;
  for (int q = 0; (q) < (Q); ++(q)) {
    scanf("%c", &c);
    scanf("%c", &c);
    scanf("%d", &a);
    if (c == '>') {
      if (a >= 0) {
        tree.update_fixed(a + 1, MAXV, -1);
      } else {
        tree.update_fixed(-a, MAXV, -1);
        if (a < -1) tree.update_flipped(1, -a - 1);
      }
    } else {
      if (a <= 0) {
        tree.update_fixed(-(a - 1), MAXV, +1);
      } else {
        tree.update_fixed(a, MAXV, +1);
        if (a > 1) tree.update_flipped(1, a - 1);
      }
    }
  }
  for (int i = 0; (i) < (N); ++(i)) {
    if (in[i] == 0) {
      printf("0 ");
    } else {
      pair<pair<int, int>, int> val = tree.query(abs(in[i]));
      if (in[i] > 0) {
        if (val.first.second) in[i] *= val.first.second;
      } else {
        if (val.first.first) in[i] *= val.first.first;
      }
      in[i] *= val.second;
      printf("%d ", in[i]);
    }
  }
  printf("\n");
  return 0;
}
