#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 2, M = 4e5 + 2;
int l[M], r[M], lz[M], ys[N], a[N];
int n, m, q, i, x, y, z, c, fh;
inline void read(int &x) {
  c = getchar();
  while ((c < 48) || (c > 57)) {
    if (c == '-') {
      c = getchar();
      fh = 1;
      break;
    }
    c = getchar();
  }
  x = c ^ 48;
  c = getchar();
  while ((c >= 48) && (c <= 57)) {
    x = x * 10 + (c ^ 48);
    c = getchar();
  }
  if (fh) x = -x, fh = 0;
}
inline int ab(int x) {
  if (x > 0) return x;
  return -x;
}
void build(int x) {
  while (l[x] < r[x]) {
    l[c = x << 1] = l[x];
    r[c] = l[x] + r[x] >> 1;
    l[c | 1] = r[c] + 1;
    r[c | 1] = r[x];
    build(c);
    x = x << 1 | 1;
  }
  ys[l[x]] = x;
}
inline void pushdown(register int x) {
  if ((lz[x]) && (l[x] < r[x])) {
    register int c = x << 1;
    if (lz[x] != 3) {
      lz[c] = lz[x];
      c |= 1;
      lz[c] = lz[x];
    } else {
      lz[c] ^= 3;
      lz[c | 1] ^= 3;
    }
    lz[x] = 0;
  }
}
void mdf(int x) {
  pushdown(x);
  if ((z <= l[x]) && (r[x] <= y)) {
    if ((l[x] < r[x]) || (c != 3))
      lz[x] = c;
    else
      lz[x] ^= 3;
    return;
  }
  if (z <= r[x << 1]) mdf(x << 1);
  if (y > r[x << 1]) mdf(x << 1 | 1);
}
void allpush(int x) {
  while (l[x] < r[x]) {
    pushdown(x);
    allpush(x << 1);
    x = x << 1 | 1;
  }
}
int main() {
  read(n);
  read(q);
  for (i = 1; i <= n; i++) {
    read(a[i]);
    m = max(m, ab(a[i]));
  }
  if (m == 0) {
    for (i = 1; i <= n; i++) printf("0 ");
    return 0;
  }
  r[l[1] = 1] = m;
  build(1);
  while (q--) {
    c = getchar();
    while ((c != '<') && (c != '>')) c = getchar();
    if (c == '<') {
      read(x);
      if (x < 0) {
        c = 2;
        z = -x + 1;
        y = m;
        if (z <= y) mdf(1);
      } else {
        c = 3;
        z = 1;
        y = x - 1;
        if (z <= y) mdf(1);
        c = 2;
        z = x;
        y = m;
        if (z <= y) mdf(1);
      }
    } else {
      read(x);
      if (x > 0) {
        c = 1;
        z = x + 1;
        y = m;
        if (z <= y) mdf(1);
      } else {
        c = 3;
        z = 1;
        y = -x - 1;
        if (z <= y) mdf(1);
        c = 1;
        z = -x;
        y = m;
        if (z <= y) mdf(1);
      }
    }
  }
  allpush(1);
  for (i = 1; i <= n; i++)
    if ((x = a[i]) < 0) {
      if (2 ^ lz[ys[ab(x)]] & 2) putchar('-');
      printf("%d ", -x);
    } else if (x == 0)
      printf("0 ");
    else {
      if (lz[ys[ab(x)]] & 1) putchar('-');
      printf("%d ", x);
    }
}
