#include <bits/stdc++.h>
using namespace std;
const int NMAX = 200000 + 5;
const int MMAX = 2000 + 5;
const int INF = 1000000000;
const int BS = 1000000000 + 7;
const long long INFLL = 1000000000ll * 1000000000ll;
const long double eps = 1e-6;
int a[NMAX];
bool is_inverted[4 * NMAX];
bool shouldSetTrue[4 * NMAX];
bool shouldSetFalse[4 * NMAX];
bool shouldInvert[4 * NMAX];
void merge_flags(int parent, int child) {
  if (shouldSetFalse[parent]) {
    shouldSetFalse[child] = true;
    shouldSetTrue[child] = false;
    shouldInvert[child] = false;
    return;
  }
  if (shouldSetTrue[parent]) {
    shouldSetFalse[child] = false;
    shouldSetTrue[child] = true;
    shouldInvert[child] = false;
    return;
  }
  if (shouldInvert[parent]) {
    if (shouldSetFalse[child]) {
      shouldSetFalse[child] = false;
      shouldSetTrue[child] = true;
      shouldInvert[child] = false;
    } else if (shouldSetTrue[child]) {
      shouldSetFalse[child] = true;
      shouldSetTrue[child] = false;
      shouldInvert[child] = false;
    } else {
      shouldInvert[child] = !shouldInvert[child];
    }
  }
}
void pass_down(int v, int tl, int tr) {
  if (tl == tr) {
    bool current = is_inverted[v];
    if (shouldSetFalse[v]) {
      current = false;
    }
    if (shouldSetTrue[v]) {
      current = true;
    }
    if (shouldInvert[v]) {
      current = !current;
    }
    is_inverted[v] = current;
    shouldSetFalse[v] = false;
    shouldSetTrue[v] = false;
    shouldInvert[v] = false;
    return;
  }
  merge_flags(v, v + v);
  merge_flags(v, v + v + 1);
  shouldSetFalse[v] = false;
  shouldSetTrue[v] = false;
  shouldInvert[v] = false;
}
bool get(int v, int tl, int tr, int pos) {
  pass_down(v, tl, tr);
  if (tl == tr) {
    return is_inverted[v];
  }
  int tm = (tl + tr) / 2;
  if (pos <= tm) {
    return get(v + v, tl, tm, pos);
  } else {
    return get(v + v + 1, tm + 1, tr, pos);
  }
}
void set_inverted(int v, int tl, int tr, int l, int r, bool shouldBeTrue,
                  bool shouldBeFalse, bool shouldBeInverted) {
  if (r < l) return;
  pass_down(v, tl, tr);
  if (l == tl && r == tr) {
    if (shouldBeFalse) {
      shouldSetFalse[v] = true;
    }
    if (shouldBeTrue) {
      shouldSetTrue[v] = true;
    }
    if (shouldBeInverted) {
      shouldInvert[v] = true;
    }
    return;
  }
  int tm = (tl + tr) / 2;
  if (r <= tm) {
    set_inverted(v + v, tl, tm, l, r, shouldBeTrue, shouldBeFalse,
                 shouldBeInverted);
  } else if (l >= tm + 1) {
    set_inverted(v + v + 1, tm + 1, tr, l, r, shouldBeTrue, shouldBeFalse,
                 shouldBeInverted);
  } else {
    set_inverted(v + v, tl, tm, l, tm, shouldBeTrue, shouldBeFalse,
                 shouldBeInverted);
    set_inverted(v + v + 1, tm + 1, tr, tm + 1, r, shouldBeTrue, shouldBeFalse,
                 shouldBeInverted);
  }
}
int main(int argc, char** argv) {
  if (argc > 1 && strcmp(argv[1], "seland") == 0) {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  }
  int n, q;
  scanf("%d %d\n", &n, &q);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  scanf("\n");
  int bias = 100000;
  for (int i = 0; i < q; i++) {
    char c;
    int x;
    scanf("%c %d\n", &c, &x);
    if (c == '<' && x <= 0) {
      x--;
      set_inverted(1, 0, NMAX - 1, 0, bias + x, true, false, false);
      set_inverted(1, 0, NMAX - 1, bias - x, 2 * bias, false, true, false);
    } else if (c == '>' && x >= 0) {
      x++;
      set_inverted(1, 0, NMAX - 1, bias + x, 2 * bias, true, false, false);
      set_inverted(1, 0, NMAX - 1, 0, bias - x, false, true, false);
    } else if (c == '<' && x > 0) {
      x--;
      set_inverted(1, 0, NMAX - 1, 0, bias - x - 1, true, false, false);
      set_inverted(1, 0, NMAX - 1, bias + x + 1, 2 * bias, false, true, false);
      set_inverted(1, 0, NMAX - 1, bias - x, bias + x, false, false, true);
    } else if (c == '>' && x < 0) {
      x++;
      set_inverted(1, 0, NMAX - 1, bias - x + 1, 2 * bias, true, false, false);
      set_inverted(1, 0, NMAX - 1, 0, bias + x - 1, false, true, false);
      set_inverted(1, 0, NMAX - 1, bias + x, bias - x, false, false, true);
    }
  }
  for (int i = 0; i < n; i++) {
    bool inverted = get(1, 0, NMAX - 1, a[i] + bias);
    if (inverted) {
      printf("%d ", -a[i]);
    } else {
      printf("%d ", a[i]);
    }
  }
  printf("\n");
  return 0;
}
