#include <bits/stdc++.h>
using namespace std;
template <class T>
void rd(T &x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + ch - '0', ch = getchar();
  x *= f;
}
const int maxn = 1e5 + 5;
int n, m;
int ans[maxn];
struct node {
  int x, op, id;
  bool operator<(const node &b) const { return x == b.x ? id < b.id : x < b.x; }
} p[maxn];
struct segment_tree {
  int op[maxn << 2], tag[maxn << 2];
  void pushdown(int u) {
    if (tag[u]) {
      op[u << 1] = op[u << 1 | 1] = 1;
      tag[u << 1] = tag[u << 1 | 1] = tag[u];
      tag[u] = 0;
    }
    if (op[u] == -1) {
      op[u << 1] *= -1;
      op[u << 1 | 1] *= -1;
      op[u] = 1;
    }
  }
  void build(int u, int l, int r) {
    op[u] = 1;
    if (l == r) return (void)(op[u] = p[l].op);
    int mid = l + r >> 1;
    build(u << 1, l, mid);
    build(u << 1 | 1, mid + 1, r);
  }
  void cover(int u, int l, int r, int ql, int qr, int v) {
    if (ql <= l && r <= qr) return (void)(op[u] = 1, tag[u] = v);
    int mid = l + r >> 1;
    pushdown(u);
    if (ql <= mid) cover(u << 1, l, mid, ql, qr, v);
    if (qr > mid) cover(u << 1 | 1, mid + 1, r, ql, qr, v);
  }
  void change(int u, int l, int r, int ql, int qr) {
    if (ql <= l && r <= qr) return (void)(op[u] *= -1);
    int mid = l + r >> 1;
    pushdown(u);
    if (ql <= mid) change(u << 1, l, mid, ql, qr);
    if (qr > mid) change(u << 1 | 1, mid + 1, r, ql, qr);
  }
  void query(int u, int l, int r) {
    if (l == r) {
      int res = tag[u] ? tag[u] * op[u] : op[u];
      ans[p[l].id] = res * p[l].x;
      return;
    }
    int mid = l + r >> 1;
    pushdown(u);
    query(u << 1, l, mid);
    query(u << 1 | 1, mid + 1, r);
  }
} seg;
int main() {
  rd(n), rd(m);
  for (int i = (1); i <= (n); ++i) {
    int x;
    rd(x);
    p[i] = (node){abs(x), x > 0 ? 1 : -1, i};
  }
  sort(p + 1, p + n + 1);
  seg.build(1, 1, n);
  while (m--) {
    char s[5];
    int x;
    scanf("%s", s);
    rd(x);
    if (s[0] == '<') {
      if (x < 0) {
        int pos = (lower_bound(p + 1, p + n + 1, (node){abs(x) + 1, 0, 0}) - p);
        if (pos <= n) seg.cover(1, 1, n, pos, n, 1);
      } else {
        int pos = (lower_bound(p + 1, p + n + 1, (node){abs(x), 0, 0}) - p);
        if (pos <= n) seg.cover(1, 1, n, pos, n, 1);
        if (pos > 1) seg.change(1, 1, n, 1, pos - 1);
      }
    } else {
      if (x > 0) {
        int pos = (lower_bound(p + 1, p + n + 1, (node){abs(x) + 1, 0, 0}) - p);
        if (pos <= n) seg.cover(1, 1, n, pos, n, -1);
      } else {
        int pos = (lower_bound(p + 1, p + n + 1, (node){abs(x), 0, 0}) - p);
        if (pos <= n) seg.cover(1, 1, n, pos, n, -1);
        if (pos > 1) seg.change(1, 1, n, 1, pos - 1);
      }
    }
  }
  seg.query(1, 1, n);
  for (int i = (1); i <= (n); ++i) printf("%d ", ans[i]);
  return 0;
}
