#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100 * 1000 + 1;
int a[MAXN];
pair<int, int> query[MAXN];
int len;
int tree[MAXN * 4][2];
vector<int> affect[MAXN * 2 + 10];
bool check(int a, pair<int, int> q) {
  if (q.first == 1) {
    return a < q.second;
  } else {
    return a > q.second;
  }
}
void up(int i) {
  if (i >= len) {
    return;
  }
  for (int it = 0; it <= 1; it++) {
    if (tree[2 * i][it] == 1) {
      tree[i][it] = tree[2 * i + 1][it];
    } else {
      tree[i][it] = -tree[2 * i + 1][1 - it];
    }
  }
}
void update(int ind) {
  ind /= 2;
  while (ind) {
    up(ind);
    ind /= 2;
  }
}
int to[MAXN * 2 + 10];
int main(int argc, const char* argv[]) {
  int n, q;
  cin >> n >> q;
  for (int i = 0; i < n; i++) {
    scanf("%i", a + i);
  }
  for (int i = 0; i < q; i++) {
    char s;
    int x;
    scanf(" %c %i ", &s, &x);
    query[i] = {s == '<', x};
    if (x > 0) {
      if (s == '<') {
        affect[x - 1 + MAXN].push_back(i);
      } else {
        affect[x + MAXN].push_back(i);
      }
    }
    if (x < 0) {
      if (s == '<') {
        affect[x + MAXN].push_back(i);
      } else {
        affect[x + 1 + MAXN].push_back(i);
      }
    }
  }
  for (len = 1; len < q; len *= 2)
    ;
  for (int i = 0; i < q; i++) {
    if (check(-MAXN, query[i])) {
      tree[i + len][0] = -1;
    } else {
      tree[i + len][0] = 1;
    }
    if (check(MAXN, query[i])) {
      tree[i + len][1] = -1;
    } else {
      tree[i + len][1] = 1;
    }
  }
  for (int i = q; i < len; i++) {
    tree[i + len][0] = 1;
    tree[i + len][1] = 1;
  }
  for (int i = len - 1; i > 0; i--) {
    up(i);
  }
  for (int i = -MAXN; i < 0; i++) {
    for (int ind : affect[i + MAXN]) {
      tree[ind + len][0] *= -1;
      update(ind + len);
    }
    for (int ind : affect[-i + MAXN]) {
      tree[ind + len][1] *= -1;
      update(ind + len);
    }
    to[i + MAXN] = tree[1][0];
    to[-i + MAXN] = tree[1][1];
  }
  to[0 + MAXN] = 1;
  for (int i = 0; i < n; i++) {
    printf("%i ", a[i] * (to[a[i] + MAXN]));
  }
  return 0;
}
