#include <bits/stdc++.h>
using namespace std;
int n, q, a[300005], b[300005];
int stk[300005], typ[300005], rv[300005], tp, rev;
inline void push(int x, int t, int r) {
  while (tp && stk[tp] >= x) r ^= rv[tp--];
  stk[++tp] = x, typ[tp] = t, rv[tp] = 0;
  if (tp - 1 && r) rv[tp - 1] ^= 1;
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= (n); ++i) scanf("%d", a + i);
  stk[tp = 1] = 100001;
  for (int i = 1; i <= (q); ++i) {
    char ch[3];
    int x;
    scanf("%s%d", ch, &x);
    if (*ch == '>') {
      if (x >= 0)
        push(x + 1, -1, 0);
      else
        rev ^= 1, push(-x, -1, 1);
    } else {
      if (x <= 0)
        push(-x + 1, 1, 0);
      else
        rev ^= 1, push(x, 1, 1);
    }
  }
  stk[++tp] = 100001, typ[tp] = 1, rv[tp] = 0;
  for (int i = tp - 1; i >= (1); --i)
    rv[i] ^= rv[i + 1], typ[i] *= rv[i] ? -1 : 1;
  for (int i = 1; i <= (tp - 1); ++i)
    for (int j = stk[i]; j <= (stk[i + 1] - 1); ++j) b[j] = typ[i];
  for (int i = 1; i <= (n); ++i) {
    if (abs(a[i]) < stk[1])
      printf("%d ", (rev ? -1 : 1) * a[i]);
    else
      printf("%d ", b[abs(a[i])] * abs(a[i]));
  }
  return 0;
}
