#include <bits/stdc++.h>
using namespace std;
int r[1 << 18];
void apply(int &a, int b) {
  if (b == -1 || b == 1)
    a = b;
  else if (b == 2) {
    if (a == 2)
      a = 0;
    else if (a == 1)
      a = -1;
    else if (a == -1)
      a = 1;
    else if (a == 0)
      a = 2;
  }
}
void push(int i) {
  if (r[i]) {
    apply(r[i * 2], r[i]);
    apply(r[i * 2 + 1], r[i]);
    r[i] = 0;
  }
}
void update(int i, int rs, int re, int qs, int qe, int op) {
  if (rs == qs && re == qe)
    apply(r[i], op);
  else {
    int m = (rs + re) / 2;
    push(i);
    if (qs < m) update(i * 2, rs, m, qs, min(m, qe), op);
    if (qe > m) update(i * 2 + 1, m, re, max(qs, m), qe, op);
  }
}
int go(int i, int rs, int re, int q) {
  if (rs == re - 1)
    return r[i];
  else {
    int m = (rs + re) / 2;
    push(i);
    if (q < m)
      return go(i * 2, rs, m, q);
    else
      return go(i * 2 + 1, m, re, q);
  }
}
int N, Q, a[100100];
int main() {
  scanf("%d %d", &N, &Q);
  for (int i = (0); i < (N); i++) scanf("%d", &a[i]);
  for (int z = (0); z < (Q); z++) {
    char op;
    int x;
    scanf(" %c %d", &op, &x);
    if (op == '<' && x >= 0) {
      update(1, 0, 1 << 17, 1, x, 2);
      update(1, 0, 1 << 17, x, 1 << 17, 1);
    } else if (op == '<' && x < 0) {
      update(1, 0, 1 << 17, abs(x - 1), 1 << 17, 1);
    } else if (op == '>' && x <= 0) {
      update(1, 0, 1 << 17, 1, abs(x), 2);
      update(1, 0, 1 << 17, abs(x), 1 << 17, -1);
    } else if (op == '>' && x > 0) {
      update(1, 0, 1 << 17, x + 1, 1 << 17, -1);
    }
  }
  for (int i = (0); i < (N); i++) {
    int op = a[i] ? go(1, 0, 1 << 17, abs(a[i])) : 0;
    if (op == 1)
      a[i] = abs(a[i]);
    else if (op == -1)
      a[i] = -abs(a[i]);
    else if (op == 2)
      a[i] *= -1;
  }
  for (int i = (0); i < (N); i++) printf("%d ", a[i]);
  puts("");
  return 0;
}
