#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int b[N], sum[N << 2], tag[N << 2], t2[N << 2];
struct P {
  int id, v;
  bool operator<(P B) const { return abs(v) < abs(B.v); }
} a[N];
void build(int x, int l, int r) {
  t2[x] = 1;
  if (l == r) {
    sum[x] = b[l];
    return;
  }
  build(x << 1, l, (l + r) / 2);
  build(x << 1 | 1, (l + r) / 2 + 1, r);
}
void pu1(int x, int l, int r) {
  tag[x << 1] = tag[x];
  tag[x << 1 | 1] = tag[x];
  t2[x << 1] = t2[x << 1 | 1] = 1;
  sum[x << 1] = tag[x];
  sum[x << 1 | 1] = tag[x];
  tag[x] = 0;
}
void inline up(int x, int c) {
  if (tag[c])
    tag[c] *= t2[x];
  else
    t2[c] *= t2[x];
}
void pu2(int x, int l, int r) {
  assert(tag[x] == 0 || t2[x] == 1);
  if (tag[x]) pu1(x, l, r);
  if (t2[x] == 1) return;
  up(x, x << 1);
  up(x, x << 1 | 1);
  sum[x << 1] *= t2[x];
  sum[x << 1 | 1] *= t2[x];
  t2[x] = 1;
}
void up1(int x, int l, int r, int L, int R, int z) {
  if (l >= L && r <= R) {
    sum[x] = z;
    tag[x] = z;
    t2[x] = 1;
    return;
  }
  pu2(x, l, r);
  if (L <= (l + r) / 2) up1(x << 1, l, (l + r) / 2, L, R, z);
  if (R > (l + r) / 2) up1(x << 1 | 1, (l + r) / 2 + 1, r, L, R, z);
}
void up2(int x, int l, int r, int L, int R, int z) {
  if (l >= L && r <= R) {
    sum[x] *= z;
    if (tag[x])
      tag[x] *= z;
    else
      t2[x] *= z;
    return;
  }
  pu2(x, l, r);
  if (L <= (l + r) / 2) up2(x << 1, l, (l + r) / 2, L, R, z);
  if (R > (l + r) / 2) up2(x << 1 | 1, (l + r) / 2 + 1, r, L, R, z);
}
int q(int x, int l, int r, int p) {
  if (l == r) return sum[x];
  pu2(x, l, r);
  if (p <= (l + r) / 2) return q(x << 1, l, (l + r) / 2, p);
  return q(x << 1 | 1, (l + r) / 2 + 1, r, p);
}
bool cmp(P x, P y) { return x.id < y.id; }
int n, qu;
int main() {
  scanf("%d%d", &n, &qu);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i].v);
    a[i].id = i;
  }
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) {
    if (a[i].v < 0) {
      b[i] = -1;
      a[i].v *= -1;
    } else
      b[i] = 1;
  }
  build(1, 1, n);
  for (int i = 1; i <= qu; i++) {
    char c;
    int t;
    scanf(" %c %d", &c, &t);
    int p = abs(t);
    P tt;
    tt.v = p;
    if (t > 0 && c == '>')
      tt.v++;
    else if (t < 0 && c == '<')
      tt.v++;
    p = lower_bound(a + 1, a + n + 1, tt) - a;
    if (c == '>') {
      if (p != n + 1) up1(1, 1, n, p, n, -1);
      if (t < 0 && p != 1) up2(1, 1, n, 1, p - 1, -1);
    } else {
      if (p != n + 1) up1(1, 1, n, p, n, 1);
      if (t > 0 && p != 1) up2(1, 1, n, 1, p - 1, -1);
    }
  }
  for (int i = 1; i <= n; i++) {
    a[i].v *= q(1, 1, n, i);
  }
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; i++) printf("%d ", a[i].v);
  return 0;
}
