#include <bits/stdc++.h>
struct node {
  int same, rev;
} T[524288];
int N, Q, a[100001];
inline void down(int p) {
  if (T[p].same) {
    T[p << 1].same = T[p].same;
    T[p << 1 | 1].same = T[p].same;
    T[p << 1].rev = T[p << 1 | 1].rev = 0;
    T[p].same = 0;
  } else if (T[p].rev) {
    if (T[p << 1].same)
      T[p << 1].same = -T[p << 1].same;
    else
      T[p << 1].rev ^= 1;
    if (T[p << 1 | 1].same)
      T[p << 1 | 1].same = -T[p << 1 | 1].same;
    else
      T[p << 1 | 1].rev ^= 1;
    T[p].rev = 0;
  }
}
void P(int p, int l, int r, int L, int R, int w) {
  if (L <= l && r <= R) {
    T[p] = {w, 0};
    return;
  }
  int m = l + r >> 1;
  down(p);
  if (L <= m) P(p << 1, l, m, L, R, w);
  if (R > m) P(p << 1 | 1, m + 1, r, L, R, w);
}
void REV(int p, int l, int r, int L, int R) {
  if (L <= l && r <= R) {
    if (T[p].same)
      T[p].same = -T[p].same;
    else
      T[p].rev ^= 1;
    return;
  }
  int m = l + r >> 1;
  down(p);
  if (L <= m) REV(p << 1, l, m, L, R);
  if (R > m) REV(p << 1 | 1, m + 1, r, L, R);
}
int G(int x) {
  int p = 1, l = -100000, r = 100000;
  while (l < r) {
    int m = l + r >> 1;
    down(p);
    if (x <= m)
      p <<= 1, r = m;
    else
      p = p << 1 | 1, l = m + 1;
  }
  return T[p].same;
}
int main() {
  scanf("%d%d", &N, &Q);
  for (int i = 1; i <= N; i++) scanf("%d", a + i);
  T[1] = {1, 0};
  while (Q--) {
    char op[2];
    int x;
    scanf("%s%d", op, &x);
    if (op[0] == '<') {
      if (x <= 0) {
        if (x != -100000) {
          P(1, -100000, 100000, -100000, x - 1, -1);
          P(1, -100000, 100000, -x + 1, 100000, 1);
        }
      } else {
        REV(1, -100000, 100000, -x + 1, x - 1);
        P(1, -100000, 100000, -100000, -x, -1);
        P(1, -100000, 100000, x, 100000, 1);
      }
    } else {
      if (x >= 0) {
        if (x != 100000) {
          P(1, -100000, 100000, x + 1, 100000, -1);
          P(1, -100000, 100000, -100000, -x - 1, 1);
        }
      } else {
        REV(1, -100000, 100000, x + 1, -x - 1);
        P(1, -100000, 100000, -100000, x, 1);
        P(1, -100000, 100000, -x, 100000, -1);
      }
    }
  }
  for (int i = 1; i <= N; i++) printf("%d%c", a[i] * G(a[i]), " \n"[i == N]);
  return 0;
}
